@contextmanager
def temp_dir():
    tmpdir = tempfile.mkdtemp()
    try:
        yield tmpdir
    finally:
        shutil.rmtree(tmpdir)
Provide a context with a temporary directory. Clean it up when done.
dataset/ETHPy150Open jdswinbank/Comet/comet/testutils.py/temp_dir