attrobj
A dictionary manipulator that enables attribute-style access to dictionary items.
Also, supports nested dictionaries and value filtering via predicates.
Example
from attrobj import Object
foo = Object({"quake": {"mw": "3.7"}})
bar = Object({"quake": {"ml": "3.9"}})
print("first quake:", foo.quake.any(["mw", "ml", "md"], key=True)) # {'mw': 3.7}
print("second quake:", bar.quake.any(["mw", "ml", "md"], key=True)) # {'ml': 3.9}
foo.haskey("quake") # True
foo.only() # Filters out None values
foo.only(lambda k, v: k[:2] == "is") # Filters keys starting with 'is'
info = Object({"quake": {"magnitude": 3.9}})
print(info.quake.magnitude) # 3.9
Release files for attrobj 0.2.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 | |
|---|---|---|---|
| attrobj-0.2.0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| attrobj-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / attrobj-0.2.0.tar.gz
| Download URL | attrobj-0.2.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba46fc8c9d89e46f07d04fcdd0b6608d3c31b7ee954cfffdc49d7b735d5a473e
|
|
BLAKE2b-256 checksum How to use checksums |
67724ad946f0fa655aff5ba12e11ad3d50ce4e481bb7983468f697df8a726f7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / attrobj-0.2.0-py3-none-any.whl
| Download URL | attrobj-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c89a556a2469487633fe903788c0c84c5bec2dda23a1f3fad21a49a88c67ac9b
|
|
BLAKE2b-256 checksum How to use checksums |
b18cadaa7615df92afde011a3cfb45e545f3710618d9731a6f9f3659ee324a13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|