✏️ 正在编辑: test_support.py
路径:
/opt/hc_python/lib/python3.12/site-packages/inotify/test_support.py
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
import os import logging import shutil import tempfile import contextlib _LOGGER = logging.getLogger(__name__) @contextlib.contextmanager def temp_path(): path = tempfile.mkdtemp() original_wd = os.getcwd() os.chdir(path) try: yield path finally: os.chdir(original_wd) if os.path.exists(path) is True: shutil.rmtree(path)
💾 保存文件
← 返回文件管理器