Skip to main content

A simple container for handling multiple tempfiles

Project description

A simple container for handling multiple tempfiles

Example:

>>> 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

tempstore-1.0.6.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

tempstore-1.0.6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tempstore-1.0.6.tar.gz.

File metadata

  • Download URL: tempstore-1.0.6.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tempstore-1.0.6.tar.gz
Algorithm Hash digest
SHA256 f821a6ed53fc767fd3286fcb6712954956af11109e046914681e53825d63fae2
MD5 a1408e0b66b32dbe7a817a51f972e8e1
BLAKE2b-256 8e5ae90cda11b9e725ee62b62bd56e5d8e5d5c44c5ef08e10f70eabc7eee3410

See more details on using hashes here.

File details

Details for the file tempstore-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for tempstore-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ea2034435d6aed04a25d9d623c77b0c6c933ad9f8a978fd700843d3f38cfd09d
MD5 1a20e232a2ba9532f97b376da4285f3b
BLAKE2b-256 5207ac6b321d95df17ca975f2ab62af5f86020c3d661847d536a93d4d6508b02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page