Comments (8)
This issue is fixed in 1.5.0 release. I will put it on pypi today.
from deepdiff.
@inoks Thanks for reporting this. This is caused by pickle caring about dictionary order which I was not aware of:
>>> import pickle
>>> a={'title': 1, 'http://purl.org/rss/1.0/modules/content/:encoded': '1'}
>>> b={'http://purl.org/rss/1.0/modules/content/:encoded': '1', 'title': 1}
>>> a==b
True
>>> pickle.dumps(a)==pickle.dumps(b)
False
>>> pickle.dumps(a)
"(dp0\nS'http://purl.org/rss/1.0/modules/content/:encoded'\np1\nS'1'\np2\nsS'title'\np3\nI1\ns."
>>> pickle.dumps(b)
"(dp0\nS'title'\np1\nI1\nsS'http://purl.org/rss/1.0/modules/content/:encoded'\np2\nS'1'\np3\ns."
I will fix it as soon as I can.
from deepdiff.
Testing further, it works correctly 90% of times in python3. I'm gonna be refactoring some code to make this work.
from deepdiff.
Hey,
I'm wondering if this is related to the issue I'm having:
d1 = {
'key1': 'val1',
'key2': [
{
'key3': 'val3',
'key4': 'val4',
},
{
'key5': 'val5',
'key6': 'val6',
},
],
}
d2 = {
'key1': 'val1',
'key2': [
{
'key3': 'val3',
'key4': 'val4',
},
{
'key5': 'CHANGE',
'key6': 'val6',
},
],
}
>>> diff = DeepDiff(d1, d2)
{'values_changed': {"root['key2'][1]['key5']": {'newvalue': 'CHANGE', 'oldvalue': 'val5'}}}
"""
works as expected. What seems to cause a problem it when
I re-order the list and have a changed value in one of the lists dicts.
Using with ignore_order=True.
"""
d1 = {
'key1': 'val1',
'key2': [
{
'key3': 'val3',
'key4': 'val4',
},
{
'key5': 'val5',
'key6': 'val6',
},
],
}
d2 = {
'key1': 'val1',
'key2': [
{
'key5': 'CHANGE',
'key6': 'val6',
},
{
'key3': 'val3',
'key4': 'val4',
},
],
}
>>> diff = DeepDiff(d1, d2, ignore_order=True)
{'iterable_item_removed': {"root['key2'][1]": {'key6': 'val6', 'key5': 'val5'}}, 'iterable_item_added': {"root['key2'][0]": {'key6': 'val6', 'key5': 'CHANGE'}}}
"""
it looks like it sees it as a new dict instead of a changed value in a current dict
"""
from deepdiff.
@ThriceGood Yep, I need to fork Pickle and make it sort data while serializing. I will do that this weekend.
from deepdiff.
@ThriceGood I looked at your notes again and you are correct, that is a whole different issue and it is currently by design. I will open a ticket and add you there so we can discuss.
from deepdiff.
Unfortunately that update does not helps with my case, I will put more complex example later.
from deepdiff.
@inoks Yes, please post an example that fails and reopen the ticket then. Thanks!
from deepdiff.
Related Issues (20)
- Unexpected Repetition of Elements when Generating Delta Between Dictionaries HOT 1
- Unsupported Operation: readline + Debug Feature HOT 2
- iterable_compare_func not working properly HOT 4
- 6.4.0 - AttributeError: 'NoneType' object has no attribute '__version__' HOT 1
- 6.4.0 importing deepdiff results in none type error HOT 5
- Simple typo in test paths generation. HOT 1
- Delta.__add__ breaks with esoteric dict keys HOT 1
- Function `parse_path` doesn't exist but is referenced in the docs. HOT 1
- Keys containing "__a__" at the beginning will be ignored. HOT 1
- Diff does not work for attributes of a class that inherits from dict or collections.UserDict HOT 4
- DeepDiff raises decimal exception when using significant digits HOT 3
- Can't compare dicts with both single and double quotes in keys HOT 3
- Inconsistent Behavior with math_epsilon and ignore_order HOT 1
- max_diffs doesn't use ignore_nan_inequality flag
- Wrong diff on list of strings HOT 3
- DeepDiff fails when dictionary keys are unrepresentable and exclude_regex_paths is not None
- Errors with dictionary_item_removed and dictionary_item_added HOT 3
- Error on Delta With None Key and Removed Item from List
- Need to be able to see full path on all outputs HOT 1
- Error when subtracting Delta from a dictionary HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepdiff.