A simple container for handling multiple tempfiles
Project description
# tempstore
A simple container for handling multiple tempfiles
Example:
`shell >>> import tempstore >>> s = tempstore.TempStore('somedata') >>> s.create('banana') '/var/folders/ng/c57k6x7n1qn9f6hw_hw4zrlcnxhmy8/T/tmpsvzuj4bd/tmp3gh1vid9' >>> s.copy('./') >>> s.cleanup() >>> `
## tempstore.TempStore(name=None)
Create a new TempStore.
## TempStore.create(name)
Create a new tempfile. This returns the path to the tempfile, and it can be accessed again later with either TempStore.paths[name] or TempStore.objs[name].name.
## TempStore.paths
Access the paths of items in the TempStore
## TempStore.objs`
Access the tempfile.NamedTemporaryFile objects of items in the TempStore
## TempStore.cleanup()
Remove all the temporary files in the TempStore
## TempStore.copy(path=None, exist_ok=True)
Copy all items in the TempStore to a given path. If TempStore.name is not None, a new directory will be created in path with the name, and all files will be copied there.
exist_ok will be passed to os.makedirs if TempStore.name is not None
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tempstore-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5958c16c0910a977bdb41232bf1719ad0128c17a29ee301af9338b704c07934a |
|
MD5 | ec1f2e84eb991f71b92bbac692bcbb7f |
|
BLAKE2b-256 | cb127247233656242d66a71c26c9ab19e337166e7d80aaef38208ea06534c8a2 |