rxn.utilities.files.named_temporary_directory

rxn.utilities.files.named_temporary_directory(delete=True)[source]

Get the path for a temporary directory and create it.

Relies on named_temporary_path to provide a context manager that will automatically delete the directory when leaving the context.

Parameters

delete (bool, default: True) – whether to delete the file when exiting the context

Return type

Iterator[Path]

Examples

>>> with named_temporary_directory() as temporary_directory:
...     # do something with the temporary directory.
...     # The directory will be deleted at the
...     # end of the context, except if delete=False.
Return type

Iterator[Path]

Parameters

delete (bool) –