mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-09-05 02:24:21 -05:00
13 lines
261 B
Python
13 lines
261 B
Python
import contextlib
|
|
import tempfile
|
|
from pathlib import Path
|
|
from typing import Iterator
|
|
|
|
|
|
@contextlib.contextmanager
|
|
def TempFile() -> Iterator[Path]:
|
|
path = Path(tempfile.NamedTemporaryFile().name)
|
|
yield path
|
|
if path.exists():
|
|
path.unlink()
|