TempContainer
TempContainer
Bases: Container
A Container that uses a temporary directory as its root. The directory is automatically cleaned up when the context manager exits.
Source code in gdutils/datacontainer/temp.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
__exit__(exc_type, exc, tb)
Exit the context manager.
Saves the container registry (via super), then cleans up the temporary directory.
Source code in gdutils/datacontainer/temp.py
47 48 49 50 51 52 53 54 55 56 | |
__init__(clean=False, infos_name='tree.json', auto_register=True, **kwargs)
Initialize a TempContainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clean
|
bool
|
Passed to Container (default False). |
False
|
infos_name
|
str
|
Registry filename (default "tree.json"). |
'tree.json'
|
auto_register
|
bool
|
Whether to auto-register files (default True). |
True
|
**kwargs
|
Any
|
Additional arguments passed to TemporaryDirectory (suffix, prefix, dir, ignore_cleanup_errors). |
{}
|
Source code in gdutils/datacontainer/temp.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |