Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

slovar - dict on steroids

Project description

Slovar

Slovar is named dicts on steroids (cheesy!) with extra functionalities (lots of them). Widely used in prf, jobs and datasets.

Some of more prominent features are:

  1. flattening/unflattening

  2. rich extracting

  3. subsetting

  4. typecasting/type converting

  5. dot notation access

  6. update/merge

Setting up & testing

mkvirtualenv slovar_test #or any other way of venv
pip install -r requirements.test
pytest
pytest benchmarks/

Examples:

In [1]: from slovar import slovar

In [2]: d = slovar({'a':1, 'b': 2, 'c.c1': '11'})

In [3]: d
Out[3]: {'a': 1, 'b': 2, 'c.c1': '11'}

In [4]: d.unflat()
Out[4]: {'a': 1, 'b': 2, 'c': {'c1': '11'}}

In [5]: d.unflat().extract('c.c1')
Out[5]: {'c': {'c1': '11'}}

In [9]: d.unflat().extract('c').c.asint('c1')
Out[9]: 11


In [10]: d
Out[10]: {'a': 1, 'b': 2, 'c.c1': '11'}

In [11]: dd = d.unflat()

In [12]: dd.c.c1
Out[12]: '11'

In [14]: dd.flat() == d
Out[14]: True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for slovar, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size slovar-1.0.2-py3-none-any.whl (23.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size slovar-1.0.2.tar.gz (19.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page