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.1.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file mergedeep-1.0.1.tar.gz
.
File metadata
- Download URL: mergedeep-1.0.1.tar.gz
- Upload date:
- Size: 3.0 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 | 83788ec949c2c52fd49480beb934499dda599591c5f060641d942d9f9747c61c |
|
MD5 | fe4c0956c54ad7f5e6e531a9f72be59a |
|
BLAKE2b-256 | c919893bc0fe359bd3c004aa241661ef6a1e519956db0a9b8c2c19e521a6ffef |
Provenance
File details
Details for the file mergedeep-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: mergedeep-1.0.1-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 | 016509cba607f786b1eade811003ad7ed23d62bcc99cc5c2531036eea3cfe4d3 |
|
MD5 | cf93e0faa29f0e750b1f388f2e05c65b |
|
BLAKE2b-256 | 4e9fb3d6dfe3836215f0a5815ba7ed7208edd9cb5e1d2a99f8bdf120e59d727e |