Persistent dictionaries
Project description
Trusty
Persistent dictionaries
Example Usage
import os
import trusty
# Create a trusty dictionary at location `pack`.
pack = trusty.get('pack')
# Set a key value pair.
pack['food'] = 'lembas'
# Persist the dictionary to disk.
pack.save()
# Confirm that the dictionary was saved.
# The `location` specifies the path on disk.
print(pack.location)
print(os.path.abspath(pack.location))
print(os.path.exists(pack.location))
We can later retrieve the dictionary like so:
import trusty
new_session = trusty.get('pack')
print(new_session)
# We can then further edit the data, and store it to the same location.
new_session['supplies'] = 'taters'
new_session.save()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
trusty-1.1.0.tar.gz
(1.7 kB
view details)
Built Distribution
File details
Details for the file trusty-1.1.0.tar.gz
.
File metadata
- Download URL: trusty-1.1.0.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d315832164f8b6f7eb8db1e2e9724e1694e33837847fbf3fb4f3122d7be104 |
|
MD5 | f3ca90db376f0c2cb68e4cf88b80ab00 |
|
BLAKE2b-256 | a3bf481f3f8094cfeef00345525e9ee7355dec74ba0f7b3698addae544ff0a08 |
File details
Details for the file trusty-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: trusty-1.1.0-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 663815bff1e22ba43ecf2845e02b6f5d917b611d1f7ad390df3da4a3ebd31285 |
|
MD5 | ffb0f492260e9eda3584f801317d4e47 |
|
BLAKE2b-256 | 1cc611df2b2e74629ccb1daf6da05db4ac78e565ad77610564d359979e63722c |