Deep compare python structures like dictionaries, lists and iterables.
Project description
Deepcomparer
Deep compare python structures like dictionaries, lists and iterables.
Usage
from deepcomparer import deep_compare
user: dict = {
'name': 'ash',
'links': {
'pokehub': '@ash'
}
}
user2: dict = {
'name': 'ash',
'links': {
'pokehub': '@brock'
}
}
print(deep_compare(user, user2))
# output: False
user2['links']['pokehub'] = '@ash'
print(deep_compare(user, user2))
# output: True
# Over iterable structures
print(deep_compare([user, user2], [user, user2]))
# output: True
# Over iterable structures
print(deep_compare([user, user2], [user2, user]))
# output: False
# Over unsorted iterable structures
print(deep_compare([user, user2], [user2, user], ignore_order=True))
# 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
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
deepcomparer-0.0.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for deepcomparer-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8646e9fad5880cc069d8b0e81e92c441788777e4e32b96ebc375a9fd432caedd |
|
MD5 | 24e620bd7d468e5bcb246246d067337d |
|
BLAKE2b-256 | 8210497c08396aea204b4016e8355a37f49e3f6f97c77e7b0790be1c1c9f2492 |