tmpdir_provider.py 333 B

1234567891011121314
  1. # (c) Nelen & Schuurmans
  2. from tempfile import TemporaryDirectory
  3. from typing import Optional
  4. __all__ = ["TmpDirProvider"]
  5. class TmpDirProvider:
  6. def __init__(self, dir: Optional[str] = None):
  7. self.dir = dir
  8. def __call__(self) -> TemporaryDirectory: # type: ignore
  9. return TemporaryDirectory(dir=self.dir)