Deepcomparer
Deep compare python objects and structures like dictionaries, lists and iterables.
Getting Started
Installation
pip install deepcomparer
Usage
from deepcomparer import deep_compare
class Pokemon:
def __init__(self, name):
self.name = name
user: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
},
'pokemons': [Pokemon('pikachu')]
}
user2: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
},
'pokemons': [Pokemon('geodude')]
}
print(deep_compare(user, user2))
# output: False
user2['pokemons'] = [Pokemon('pikachu')]
print(deep_compare(user, user2))
# output: True
from deepcomparer import deep_compare
ash_data: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
}
}
brock_data: dict = {
'name': 'brock',
'links': {
'pokehub': '@brock'
}
}
# Over iterable structures
print(deep_compare([ash_data, brock_data], [ash_data, brock_data]))
# output: True
# Over iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data]))
# output: False
# Over unsorted iterable structures
print(deep_compare([ash_data, brock_data], [brock_data, ash_data], ignore_order=True))
# output: True
Metadata
Release files for deepcomparer 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deepcomparer-0.4.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deepcomparer-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.8 kB
Release files / deepcomparer-0.4.0.tar.gz
| Download URL | deepcomparer-0.4.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c99a1fd328b350bbdfcf597f61e1cfb76d150c38dedf46ec709bf5eeeb7b88de
|
|
BLAKE2b-256 checksum How to use checksums |
4b3384a4de3c7081ea7132d6dcae54243ec56f1a77bb7f30f184f0fe7813ea73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Release files / deepcomparer-0.4.0-py3-none-any.whl
| Download URL | deepcomparer-0.4.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89d92f2c14e0d7afc9451739fc1228a46028054182b1387a5710a7ad2cf4d46b
|
|
BLAKE2b-256 checksum How to use checksums |
0063815fc0dacdd898cfa9e9145982fbac94160581170e6a5dc51cc0abe8b43c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|