GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — comparing lists of sets if ignore_order=True #19 · fellow/deepdiff@8d1267e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • AUTHORS
  • README.md
  • README.txt
  • deepdiff
    • deepdiff.py
  • docs
    • conf.py
    • index.rst
  • setup.py
  • tests
    • tests.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎AUTHORS‎

Copy file name to clipboardExpand all lines: AUTHORS
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Thanks to:
66
* nfvs for Travis-CI setup script
77
* brbsix for initial Py3 porting
88
* WangFenjin for unicode support
9+
* timoilya for comparing list of sets when ignoring order
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# deepdiff v 1.0.0
1+
# deepdiff v 1.0.1
22

33
![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat)
44
![Python Versions](https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat)
@@ -233,6 +233,7 @@ int, string, dictionary, list, tuple, set, frozenset, OrderedDict, NamedTuple an
233233

234234
##Changelog
235235

236+
- v1-0-1: Better ignore order support
236237
- v1-0-0: Restructuring output to make it more useful. This is NOT backward compatible.
237238
- v0-6-1: Fixiing iterables with unhashable when order is ignored
238239
- v0-6-0: Adding unicode support
Collapse file

‎README.txt‎

Copy file name to clipboardExpand all lines: README.txt
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**DeepDiff v 1.0.0**
1+
**DeepDiff v 1.0.1**
22

33
Deep Difference of dictionaries, iterables, strings and almost any other object. It will recursively look for all the changes.
44

@@ -179,6 +179,7 @@ Object attribute added:
179179

180180
**Changelog**
181181

182+
- v1-0-1: Better ignore order support
182183
- v1-0-0: Restructuring output to make it more useful. This is NOT backward compatible.
183184
- v0-6-1: Fixiing iterables with unhashable when order is ignored
184185
- v0-6-0: Adding unicode support
Collapse file

‎deepdiff/deepdiff.py‎

Copy file name to clipboardExpand all lines: deepdiff/deepdiff.py
+6-10Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
import difflib
77
import datetime
8-
import json
8+
try:
9+
import cPickle as pickle
10+
except:
11+
import pickle
912
from decimal import Decimal
1013
from sys import version
1114
from collections import Iterable
@@ -49,7 +52,7 @@ class ListItemRemovedOrAdded(object):
4952
class DeepDiff(dict):
5053

5154
r"""
52-
**DeepDiff v 1.0.0**
55+
**DeepDiff v 1.0.1**
5356
5457
Deep Difference of dictionaries, iterables, strings and almost any other object.
5558
It will recursively look for all the changes.
@@ -388,7 +391,7 @@ def __create_hashtable(t, parent):
388391
item_hash = hash(item)
389392
except TypeError:
390393
try:
391-
item_hash = hash(json.dumps(item, default=json_default))
394+
item_hash = hash(pickle.dumps(item))
392395
except Exception as e:
393396
print ("Warning: Can not produce a hash for %s item in %s and\
394397
thus not counting this object. %s" % (item, parent, e))
@@ -474,13 +477,6 @@ def changes(self):
474477
return self
475478

476479

477-
def json_default(obj):
478-
'''Dealing with unserializable objects'''
479-
if isinstance(obj, Decimal):
480-
return float(obj)
481-
else:
482-
raise TypeError
483-
484480
if __name__ == "__main__":
485481
import doctest
486482
doctest.testmod()
Collapse file

‎docs/conf.py‎

Copy file name to clipboardExpand all lines: docs/conf.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = '1.0.0'
62+
version = '1.0.1'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '1.0.0'
64+
release = '1.0.1'
6565

6666
# The language for content autogenerated by Sphinx. Refer to documentation
6767
# for a list of supported languages.
Collapse file

‎docs/index.rst‎

Copy file name to clipboardExpand all lines: docs/index.rst
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Install from PyPi::
2020

2121

2222
**************
23-
DeepDiff 1.0.0
23+
DeepDiff 1.0.1
2424
**************
2525

2626
.. toctree::
@@ -44,6 +44,7 @@ Indices and tables
4444
Changelog
4545
=========
4646

47+
- v1-0-1: Better ignore order support
4748
- v1-0-0: Restructuring output to make it more useful. This is NOT backward compatible.
4849
- v0-6-1: Fixiing iterables with unhashable when order is ignored
4950
- v0-6-0: Adding unicode support
Collapse file

‎setup.py‎

Copy file name to clipboardExpand all lines: setup.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
long_description = "Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes."
1414

1515
setup(name='deepdiff',
16-
version='1.0.0',
16+
version='1.0.1',
1717
description='Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes.',
1818
url='https://github.com/seperman/deepdiff',
1919
download_url='https://github.com/seperman/deepdiff/tarball/master',
Collapse file

‎tests/tests.py‎

Copy file name to clipboardExpand all lines: tests/tests.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"""
55
To run the test, run this in the root of repo:
66
python -m unittest discover
7+
8+
To run a specific test, run this from the root of repo:
9+
python -m unittest tests.DeepDiffTestCase.test_list_of_sets_difference_ignore_order
710
"""
811
import unittest
912
from decimal import Decimal
@@ -123,6 +126,13 @@ def test_list_of_unhashable_difference_ignore_order2(self):
123126
'iterable_item_removed': {'root[3]': 'B', 'root[0]': 1}}
124127
self.assertEqual(ddiff, result)
125128

129+
def test_list_of_sets_difference_ignore_order(self):
130+
t1 = [{1}, {2}, {3}]
131+
t2 = [{4}, {1}, {2}, {3}]
132+
ddiff = DeepDiff(t1, t2, ignore_order=True)
133+
result = {'iterable_item_added': {'root[0]': {4}}}
134+
self.assertEqual(ddiff, result)
135+
126136
def test_list_that_contains_dictionary(self):
127137
t1 = {1: 1, 2: 2, 3: 3, 4: {"a": "hello", "b": [1, 2, {1: 1, 2: 2}]}}
128138
t2 = {1: 1, 2: 2, 3: 3, 4: {"a": "hello", "b": [1, 2, {1: 3}]}}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.