A deep merge function for 🐍.
Project description
mergedeep
A deep merge function for 🐍.
Installation
$ pip install mergedeep
Usage
merge(target: Map[KT, VT], *sources: Map[KT, VT]) -> Map[KT, VT]
Deep merge without mutating the source dicts.
from mergedeep import merge
a = {"keyA": 1}
b = {"keyB": {"sub1": 10}}
c = {"keyB": {"sub2": 20}}
merged = merge({}, a, b, c)
print(merged)
# {"keyA": 1, "keyB": {"sub1": 10, "sub2": 20}}
Deep merge into an existing dict.
from mergedeep import merge
a = {"keyA": 1}
b = {"keyB": {"sub1": 10}}
c = {"keyB": {"sub2": 20}}
merge(a, b, c)
print(a)
# {"keyA": 1, "keyB": {"sub1": 10, "sub2": 20}}
License
MIT © Travis Clarke
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mergedeep-1.0.0.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file mergedeep-1.0.0.tar.gz
.
File metadata
- Download URL: mergedeep-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29ff76cc9c4d16141ac82fc222c479fca3d4ddf6afdad169cdae29e0ac3bb300 |
|
MD5 | 4a2fcad7b55c5830bff5efe350ffab6d |
|
BLAKE2b-256 | 753994947d4f2f39ad715f8f59808b7aeb44c912223b934d4fa922a3073462d6 |
Provenance
File details
Details for the file mergedeep-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: mergedeep-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f76b1ce02e87b99a2e12f2955736e6a2233d59bd07271530e35357558395aefe |
|
MD5 | a242bbdac6130c6aa7d350abb1ffac7f |
|
BLAKE2b-256 | 85e9ced5a2103777992ec818c481aabe54bbf3cb3261d6fee5ef024c1b931993 |