frozenjsondict
Inspired in https://github.com/slezica/python-frozendict, this variation takes it one step further and lets you build immutable JSON dictionaries that can be used as dictionary keys and set elements.
Its hash function uses JSON serialization, so you can use it as long as your data is JSON-serializable.
Example of usage:
from frozenjsondict import FrozenJsonDict
fjd_1 = FrozenJsonDict({"a": [1, 2, 3]})
fjd_2 = FrozenJsonDict({"b": [3, 4], "c": [6]})
fjd_3 = FrozenJsonDict({"c": [6], "b": [3, 4]})
# Support for common interfaces
"a" in fjd_1 # True
fjd_1["a"] # [1, 2, 3]
fjd_1.a # [1, 2, 3]
len(fjd_2) # 2
fjd_2 == fjd_3 # True
for key, value in fjd_2.items():
print(f"{key}: {value}")
# b: [3, 4]
# c: [6]
# Usage as dictionary key
fjd_dict = dict()
fjd_dict[fjd_1] = 1
fjd_dict[fjd_2] = 2
fjd_dict[fjd_3] = 3
print(fjd_dict)
# {<FrozenJsonDict {"a":[1,2,3]}>: 1, <FrozenJsonDict {"b":[3,4],"c":[6]}>: 3}
# Usage as set element
fjd_set = set()
fjd_set.add(fjd_1)
fjd_set.add(fjd_2)
fjd_set.add(fjd_3)
print(fjd_set)
# {<FrozenJsonDict {"a":[1,2,3]}>, <FrozenJsonDict {"b":[3,4],"c":[6]}>}
Metadata
Release files for frozenjsondict 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| frozenjsondict-1.0.0.tar.gz | 2.8 kB | Without provenance | Details for frozenjsondict-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| frozenjsondict-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for frozenjsondict-1.0.0-py3-none-any.whl |
Total release size: 6.0 kB
Release files / frozenjsondict-1.0.0.tar.gz
| Download URL | frozenjsondict-1.0.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac92af929d7317f28cfacb4007fdd3960669ed2fd18009fc4c8d0cbc52454b09
|
|
BLAKE2b-256 checksum How to use checksums |
36cb75f9169c537660b53f46aa2636806a3b641b10dc17eb2c700fe69f0ef01e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Release files / frozenjsondict-1.0.0-py3-none-any.whl
| Download URL | frozenjsondict-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62856957a4d94947cbe0e09959d415dc908b3d55a9a4525a683aabe926529afe
|
|
BLAKE2b-256 checksum How to use checksums |
5a8e1d7e98e4e5199c8c7f8ec59645b8a4da50832933a1eb6e5649e0ba96a9c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Security for frozenjsondict 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.