Skip to main content

Resolve dot notation from dictionary

Project description

pyresolve

Resolve dot notation from dictionary

from pyresolve import resolve

my_dictionary = {"out":{"middle":{"in":"Balue"}}}

# Before
my_dictionary.get('out', {}).get('middle', {}).get('in')

# After
resolve(my_dictionary, "out.middle.in") # "Balue"

Does not break for missing properties

resolve(my_dictionary, "outer.missing.something") # None

Can specify a different default value

resolve(my_dictionary, "outer.missing.something", []) # []

Supports index in list

dictionary_with_list = {"users": [{"name":"Joe"}, {"name":"Jane"}]}
resolve(my_dictionary, "users.1.name") # Jane

Install

pip install pyresolve

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

pyresolve-1.1.0.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

pyresolve-1.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file pyresolve-1.1.0.tar.gz.

File metadata

  • Download URL: pyresolve-1.1.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.8.0 tqdm/4.62.3 CPython/3.7.4

File hashes

Hashes for pyresolve-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5482400bbe7a8ba4bf5e2b0ec480a7bc69d68cf41a02f58452c20a8a02f49af6
MD5 d3d039cd683f75b2a210677795318f69
BLAKE2b-256 94cb774c41b436aa0fc0afe7f596b7b7b34af9a83c308d4eb33e7165d1e81579

See more details on using hashes here.

File details

Details for the file pyresolve-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyresolve-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.8.0 tqdm/4.62.3 CPython/3.7.4

File hashes

Hashes for pyresolve-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5567469ca99ad54b4075952e5e7dd21d9d8abf92bdf6e8c0d1407a9c2f0198d8
MD5 45e18a6a0f5bb7538da3110b1ba290b8
BLAKE2b-256 7be732bc295306194793bf0346118ff01a220140b8af47b5327721ef1cdf96cc

See more details on using hashes here.

Supported by

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