Skip to main content

A package to enable setting and getting of nested dictionaries using paths.

Project description

DottedDict

Examples

from nestydict import Nesty

normal_dict = {
    "metrics.cost.name": "cost_micros",
    "metrics.cost.value": 123123,
    "metrics.campaign": {"name": "Extra Clicks", "metrics.cost_micros": 100},
}

dotted = Nesty.from_dict(normal_dict)

dotted
# {
#     "metrics": {
#         "cost": {
#             "name": "cost_micros",
#             "value": 123123
#         },
#         "campaign": {
#             "name": "Extra Clicks",
#             "metrics": {
#                 "cost_micros": 100
#             }
#         }
#     }
# }
from nestydict import Nesty

dotted = Nesty()
dotted["metrics.cost.name"] = "cost_micros"
dotted["metrics.cost.id"] = 123123
dotted["metrics.cost.type"] = "money"
dotted["metrics.campaign"] = [{"A": 1}]

dotted
# {
#     "metrics": {
#         "cost": {
#           "name": "cost_micros",
#           "id": 123123,
#           "type": "money"
#       },
#         "campaign": [{"A": 1}],
#     }
# }

dotted["metrics.cost"]
# {
#     "name": "cost_micros",
#     "id": 123123,
#     "type": "money"
# }

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

NestyDict-0.0.6.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

NestyDict-0.0.6-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file NestyDict-0.0.6.tar.gz.

File metadata

  • Download URL: NestyDict-0.0.6.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for NestyDict-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c89080481df0ea9b524b949f7c7bc76e8045f4270e51f4d678cd1f5668b04198
MD5 e1cdd85515282511d654127a6a2df461
BLAKE2b-256 a2193997cf1a4783601efcef5a38d7085e0797b8fed527c09b239d4dda3a1623

See more details on using hashes here.

File details

Details for the file NestyDict-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: NestyDict-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for NestyDict-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 91404371d827d761bc76929fdcc6b151144b90be363f958460b882e23f72b2bf
MD5 bb39b8a0662d4b6c7a772006c74ed98a
BLAKE2b-256 721c5417e1d79dcd6f1c0dc84fc6298bfe1a3e2bc946376e3cdf759b2c2d5058

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