Files
chia-blockchain/chia/_tests/util/temp_file.py
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00

15 lines
306 B
Python

from __future__ import annotations
import contextlib
import tempfile
from collections.abc import Iterator
from pathlib import Path
@contextlib.contextmanager
def TempFile() -> Iterator[Path]:
path = Path(tempfile.NamedTemporaryFile().name)
yield path
if path.exists():
path.unlink()