Skip to main content

traverse nested dicts and deal with it

Project description

dict8

features

  • No boilerplate: just a, b, path and some code.

  • Enables you to define a specific merge behavior for every part of the tree.

  • Merge into datclasses or attrs.

internal

The default machinery converts all input data to a Mapper. If a and b are mappable, the new, common and old values are taken to a custom function to decide upon the value precedence. Returning py:obj:missing will omit this key from the intermediate result. The chosen mapper will decide how to incorporate the latter.

example

import dict8


@dict8.ion
def merge(a, b, path, /, **kv):
    try:
        # try descent into sub mappings
        return merge(
            a,
            b,
            path,
            **kv,
        )
    except UnMappable:
        # take b else a
        return b if b not dict8.missing else a

license

This is public domain.

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

dict8-0.0.1.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

dict8-0.0.1-py3-none-any.whl (1.7 kB view details)

Uploaded Python 3

File details

Details for the file dict8-0.0.1.tar.gz.

File metadata

  • Download URL: dict8-0.0.1.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for dict8-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a85ba9a0803b9e1c32d91e83e724c34480e6eb43cce007ea327ac5e626e92378
MD5 08c4f8b06b90a390dfac42d35e434ee9
BLAKE2b-256 92c78a76250e083f21d821faffd03a5bc52badde48dffc35247904f02f38ee09

See more details on using hashes here.

File details

Details for the file dict8-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dict8-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for dict8-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69ceb94925f82c778e1e0e6c7e419dc97451c062d9ca0e8ae7902645226f15e3
MD5 65813bfcb02462f75a511cda4585c016
BLAKE2b-256 32e63460f5b353466fff20cd532f03e4af201ed010cbac1c8fdc723d9dbe9628

See more details on using hashes here.

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