Skip to main content

bigt

Downloads License Doc

Bigt is a Python library for compare or merge nested unsorted dictionaries.

Examples:

from bigt.dictext import DictExt

a = {"a": {"a": "str", "b": 123}}
b = {"a": {"a": "str", "b": 1234}}
result, not_present, changed = DictExt(b).issubset(a)
assert not result
assert changed == {"a": {"b": {"old": 1234, "new": 123} } }
assert not not_present
>>> DictExt({"a": 3, "b": [{"b": 123}]}) + DictExt({"a": 1, "c": False, "b": [{"a": 12.64}]})
{'a': 1, 'b': [{'b': 123, 'a': 12.64}], 'c': False}
>>> DictExt({"aa": 3, "a": [{"b": {"bv": 1, "bc": 2}, "a": 1}, [3,1,8,5]]}).sort()
{'a': [[1, 3, 5, 8], {'a': 1, 'b': {'bc': 2, 'bv': 1}}], 'aa': 3}

Show difference visually

Install rich python library or use pip install Bigt[rich]

from bigt.pprint import pprint

a = {"a":[{'z': {'a': '21', 'b': False, 'd': '20'}}, {'z': {'a': '1', 'b': False, 'd': '2'}}]}
b = {"a":[{'z': {'a': '1', 'b': False, 'd': {"a": '20'}, "y": {"a": 2}}}]}

pprint(b, a, weights={"a": {'z': {"a": 2}}})

from bigt.pprint import pprint

a = {"a":[{'z': {'a': '21', 'b': False, 'd': '20'}}, {'z': {'a': '1', 'b': False, 'd': '2'}}]}
b = {"a":[{'z': {'a': '1', 'b': False, 'd': {"a": '20'}, "y": {"a": 2}}}]}

pprint(a, b, weights={"a": {'z': {"a": 2}}})

Assert on difference found

from bigt.pprint import assert_issubset

a = {"a":[{'z': {'a': '21', 'b': False, 'd': '20'}}, {'z': {'a': '1', 'b': False, 'd': '2'}}]}
b = {"a":[{'z': {'a': '1', 'b': False, 'd': {"a": '20'}, "y": {"a": 2}}}]}

assert_issubset(a, b, weights={"a": {'z': {"a": 2}}})

Release files for Bigt 2022.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for Bigt 2022.1.4
File Interpreter ABI Platform
Bigt-2022.1.4-py3-none-any.whl Python 3 none any Details

Release files / Bigt-2022.1.4-py3-none-any.whl

Download URL Bigt-2022.1.4-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d45ab6a50cdb98d622972a73cdf2701bf4a92cd8d2b0e3edd0d52dc2babd25c
BLAKE2b-256 checksum
How to use checksums
08c4ea96e9442da07878f3904c949dc56723203b4afe458490cb8ff947f3619e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release history Release notifications | RSS feed

This release

2022.1.4 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page