frozenjsondict-1.0.0
توضیحات
Immutable JSON dictionary with hash functionality
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | frozenjsondict-1.0.0 |
| نام | frozenjsondict |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | ['Carlos Ruiz Lantero'] |
| ایمیل نگهدارنده | ['carlos.ruiz.lantero@comprehensivetech.co.uk'] |
| نویسنده | Carlos Ruiz Lantero |
| ایمیل نویسنده | carlos.ruiz.lantero@comprehensivetech.co.uk |
| آدرس صفحه اصلی | https://github.com/comprehensivetech/frozenjsondict |
| آدرس اینترنتی | https://pypi.org/project/frozenjsondict/ |
| مجوز | - |

# frozenjsondict
Inspired in [https://github.com/slezica/python-frozendict](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:
```python
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]}>}
```
نیازمندی
| مقدار | نام |
|---|---|
| ==20.8b1 | black |
| ==3.9.0 | flake8 |
| ==6.2.3 | pytest |
| ==2.11.1 | pytest-cov |
نحوه نصب
نصب پکیج whl frozenjsondict-1.0.0:
pip install frozenjsondict-1.0.0.whl
نصب پکیج tar.gz frozenjsondict-1.0.0:
pip install frozenjsondict-1.0.0.tar.gz