Attribute-based data structures.
Project description
attrbox
Attribute-based data structures.
Changelog - Issues - Documentation
Why?
There are three things I repeatedly have to deal with:
-
AttrDict
deals with shortcomings of the standard pythondict
:- You can use attribute syntax (
thing.prop
instead ofthing["prop"]
). - Instead of handling
KeyError
or using.get(None)
, you can just get aNone
by default. - It's easy to merge nested
dict
objects using the<<
operator.
- You can use attribute syntax (
-
AttrList
lets you build a powerful container that can easily query attributes of its members. -
JSend
is a rough implementation of theJSend
sepecification that makes it easy to create standard JSON responses.
Install
pip install attrbox
Example
import json
from attrbox import AttrDict
config = AttrDict() << json.load(open('test/example-appengine.json'))
print(config.deployment.files["example-resource-file1"].sourceUrl)
# => "https://storage.googleapis.com/[MY_BUCKET_ID]/example-application/example-resource-file1"
License
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
attrbox-0.1.0.tar.gz
(7.9 kB
view hashes)