Recursive diff for nested structures
Project description
Nested-Diff.py
Recursive diff for nested structures, implementation of Nested-Diff
Dicts and lists traversed recursively, all other types compared by values.
Status
Alpha, WIP.
Examples
>>> from nested_diff import diff, patch
>>>
>>> a = {'one': 1, 'two': 2, 'three': 3}
>>> b = {'one': 1, 'two': 42}
>>>
>>> diff(a, b)
{'D': {'three': {'R': 3}, 'two': {'O': 2, 'N': 42}, 'one': {'U': 1}}}
>>>
>>> diff(a, b, O=False, U=False)
{'D': {'two': {'N': 42}, 'three': {'R': 3}}}
>>>
>>>
>>> c = [0,1,2,3]
>>> d = [ 1,2,4,5]
>>>
>>> diff(c, d, O=False, U=False)
{'D': [{'R': 0}, {'I': 3, 'N': 4}, {'A': 5}]}
>>>
>>>
>>> c = patch(c, diff(c, d))
>>> assert c == d
>>>
License
Licensed under the terms of the Apache License, Version 2.0.
See Also
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
nested_diff-0.2.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for nested_diff-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f58cdb3672699d89055b2b9ab3b582e7118f161be85d57b19b5caae68dbfe36 |
|
MD5 | da7d7204523d50e2287aa50f8c01b200 |
|
BLAKE2b-256 | 26eda5362aeb4bfb34cb75ba39687591bcd90eee778d08d486bda36c060419e5 |