MCPcopy
hub / github.com/pydata/xarray / create_tmp_file

Function create_tmp_file

xarray/tests/test_backends.py:1718–1730  ·  view source on GitHub ↗
(
    suffix: str = ".nc", allow_cleanup_failure: bool = False
)

Source from the content-addressed store, hash-verified

1716
1717@contextlib.contextmanager
1718def create_tmp_file(
1719 suffix: str = ".nc", allow_cleanup_failure: bool = False
1720) -> Iterator[str]:
1721 temp_dir = tempfile.mkdtemp()
1722 path = os.path.join(temp_dir, f"temp-{next(_counter)}{suffix}")
1723 try:
1724 yield path
1725 finally:
1726 try:
1727 shutil.rmtree(temp_dir)
1728 except OSError:
1729 if not allow_cleanup_failure:
1730 raise
1731
1732
1733@contextlib.contextmanager

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…