Skip to main content

Traversing and Querying Dicts the easy way

Project description

https://badge.fury.io/py/t_dict.png https://travis-ci.org/vandersonmota/t_dict.png?branch=master https://pypip.in/d/t_dict/badge.png

Traversing and Querying Dicts the easy way

  • Free software: BSD license

Install

pip install t_dict

Why?

Dealing with deep nested dicts can be a total pain. TDict aims to make less boring working with it, using jsonpointer syntax for that.

It stand on the shoulders of jsonpointer (https://pypi-hypernode.com/pypi/jsonpointer), which implements the RFC - https://tools.ietf.org/html/rfc6901

Usage

from t_dict.t_dict import TDict

td = TDict({'nested': { 'dict': 'here', 'other': {'spam': 'eggs'} }})
td.find('/nested/dict')
>> 'here'
td.find('/nested/notfound', 'defaultvalue')
>> 'defaultvalue'

td.setin('/nested/dict', 'new')
td['nested']['dict'] == 'new'
>> True

# converts dict to TDict
isinstance(td.find('/nested/other'), TDict)
>> True

History

0.1.0 (2014-01-11)

  • First release on PyPI.

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

t_dict-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file t_dict-0.1.1.tar.gz.

File metadata

  • Download URL: t_dict-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for t_dict-0.1.1.tar.gz
Algorithm Hash digest
SHA256 97d5191a4314854577612e41043029dba27ca777ddfefd327d2b5b31108f62c9
MD5 552f7f765df7b880d8b9f1d5c190904b
BLAKE2b-256 48e67ee67725214a2976e6a8c9450d26efbc3d6724e52dfd5bc58ecffd9d71fc

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page