godlib
English | 中文
嵌套字典递归合并,可选列表拼接策略。
安装
pip install godlib
用法
from godlib import deep_merge, ListMode
base = {"db": {"host": "localhost", "port": 5432}, "tags": ["a"]}
over = {"db": {"port": 6543}, "tags": ["b"]}
deep_merge(base, over)
# {'db': {'host': 'localhost', 'port': 6543}, 'tags': ['b']}
decode = deep_merge(base, over, n_list=ListMode.APPEND)
# {'db': {...}, 'tags': ['a', 'b']}
说明
两边都是 dict 时递归合并,其余类型由覆盖值胜出;n_list 决定列表是替换、追加还是前置;入参全程深拷贝,不会改动调用方的对象。
许可证
MIT
English
Recursive dict merge with explicit list handling.
Install
pip install godlib
Usage
from godlib import deep_merge, ListMode
base = {"db": {"host": "localhost", "port": 5432}, "tags": ["a"]}
over = {"db": {"port": 6543}, "tags": ["b"]}
deep_merge(base, over)
# {'db': {'host': 'localhost', 'port': 6543}, 'tags': ['b']}
decode = deep_merge(base, over, n_list=ListMode.APPEND)
# {'db': {...}, 'tags': ['a', 'b']}
Notes
Nested dicts merge recursively; every other type is taken from the override. n_list decides whether lists replace, append or prepend. Inputs are deep-copied, never mutated.
License
MIT
Metadata
Release files for godlib 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| godlib-0.0.4.tar.gz | 3.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| godlib-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / godlib-0.0.4.tar.gz
| Download URL | godlib-0.0.4.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
163175b5f33a606ec621efb9c2471fd227c5628074098a13294c60c66846812b
|
|
BLAKE2b-256 checksum How to use checksums |
3824d504773be86f6de39f74e1681408a9e7f769cbecfb344acd3a0e2d1df3c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / godlib-0.0.4-py3-none-any.whl
| Download URL | godlib-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9ec25f2cc661fdc2fb98050d73c91251fff1e12a06b8882b56e6d027c4ee7b0
|
|
BLAKE2b-256 checksum How to use checksums |
f974e806f99dedc72d1c9360415b0d0adb13d71e256e6deb9a72a8830f7b1dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for godlib 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.