Skip to main content

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.

Source Distribution

slovar-1.0.1.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slovar-1.0.1-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file slovar-1.0.1.tar.gz.

File metadata

  • Download URL: slovar-1.0.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.6

File hashes

Hashes for slovar-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3124f3d4471369ac75c355f7896af59c3a8c3f145d29dcd7eaca7ec9b28ce098
MD5 d58b23120ff0590d6781b6c45ebad0a9
BLAKE2b-256 f98d1b1a34ae8950eb6fba1ed47077b820b596aeaac784928aedfa0d5b2d4301

See more details on using hashes here.

File details

Details for the file slovar-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: slovar-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.6

File hashes

Hashes for slovar-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b644763456ee62379d07af3eb9f63baa8f4770e04f8b945a3175ae60e384d1e3
MD5 fb314f6fd2196727e111f5472824f494
BLAKE2b-256 913dec9ebb0a18cb5e9b0144b06ca81573583c88cd767b52bf38f0e86f0081f1

See more details on using hashes here.

Supported by

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