Skip to content

Commit 940ea1a

Browse files
committed
updating docs
1 parent 8ab3925 commit 940ea1a

File tree

4 files changed

+46
-28
lines changed

4 files changed

+46
-28
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ And if you don't care about the value of items that have changed type, please se
130130
```python
131131
>>> t1 = {1:1, 2:2, 3:3}
132132
>>> t2 = {1:1, 2:"2", 3:3}
133-
>>> pprint(DeepDiff(t1, t2), indent=2)
133+
>>> pprint(DeepDiff(t1, t2, verbose_level=0), indent=2)
134134
{ 'type_changes': { 'root[2]': { 'new_type': <class 'str'>,
135135
'old_type': <class 'int'>,}}}
136136
```
@@ -381,8 +381,9 @@ And here is more info: <http://zepworks.com/blog/diff-it-to-digg-it/>
381381

382382
##Changelog
383383

384-
- v1-8-0: Exclusion patterns
385-
- v1-7-0: Deep Set comparison
384+
- v2-0-0: Exclusion patterns better coverage. Updating docs.
385+
- v1-8-0: Exclusion patterns.
386+
- v1-7-0: Deep Set comparison.
386387
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
387388
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
388389
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.

README.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ Deep Difference of dictionaries, iterables, strings and other objects. It will r
44

55
Tested on Python 2.7, 3.3, 3.4, 3.5, Pypy, Pypy3
66

7-
**Pycon 2016**
8-
9-
I was honored to give a talk about how DeepDiff does what it does at Pycon 2016. Please check out the video and let me know what you think:
10-
11-
Diff It To Dig It Video
12-
https://www.youtube.com/watch?v=J5r99eJIxF4
13-
And here is more info:
14-
http://zepworks.com/blog/diff-it-to-digg-it/
15-
167
**Parameters**
178

189
In addition to the 2 objects being compared:
@@ -220,11 +211,21 @@ Example in DeepDiff for the same operation:
220211
>>> DeepDiff(item1, item2)
221212
{'type_changes': {"root['a']['b']['c']": {'old_type': <type 'str'>, 'new_value': 42, 'old_value': 'foo', 'new_type': <type '
222213

214+
**Pycon 2016**
215+
216+
I was honored to give a talk about how DeepDiff does what it does at Pycon 2016. Please check out the video and let me know what you think:
217+
218+
Diff It To Dig It Video
219+
https://www.youtube.com/watch?v=J5r99eJIxF4
220+
And here is more info:
221+
http://zepworks.com/blog/diff-it-to-digg-it/
222+
223223

224224
**Changelog**
225225

226-
- v1-8-0: Exclusion patterns
227-
- v1-7-0: Deep Set comparison
226+
- v2-0-0: Exclusion patterns better coverage. Updating docs.
227+
- v1-8-0: Exclusion patterns.
228+
- v1-7-0: Deep Set comparison.
228229
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
229230
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
230231
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.

deepdiff/deepdiff.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,11 @@ def __getitem__(self, old_key):
105105
class DeepDiff(RemapDict):
106106

107107
r"""
108-
**DeepDiff v 1.7.0**
108+
**DeepDiff**
109109
110110
Deep Difference of dictionaries, iterables, strings and almost any other object.
111111
It will recursively look for all the changes.
112112
113-
**Pycon 2016 Talk**
114-
I gave a talk about how DeepDiff does what it does at Pycon 2016.
115-
`Diff it to Dig it Pycon 2016 video <https://www.youtube.com/watch?v=J5r99eJIxF4>`_
116-
117-
And here is more info: http://zepworks.com/blog/diff-it-to-digg-it/
118-
119113
**Parameters**
120114
121115
t1 : A dictionary, list, string or any python object that has __dict__ or __slots__
@@ -157,6 +151,12 @@ class DeepDiff(RemapDict):
157151
158152
int, string, unicode, dictionary, list, tuple, set, frozenset, OrderedDict, NamedTuple and custom objects!
159153
154+
**Pycon 2016 Talk**
155+
I gave a talk about how DeepDiff does what it does at Pycon 2016.
156+
`Diff it to Dig it Pycon 2016 video <https://www.youtube.com/watch?v=J5r99eJIxF4>`_
157+
158+
And here is more info: http://zepworks.com/blog/diff-it-to-digg-it/
159+
160160
**Examples**
161161
162162
Importing
@@ -182,17 +182,24 @@ class DeepDiff(RemapDict):
182182
Value of an item has changed
183183
>>> t1 = {1:1, 2:2, 3:3}
184184
>>> t2 = {1:1, 2:4, 3:3}
185-
>>> pprint(DeepDiff(t1, t2), indent=2)
185+
>>> pprint(DeepDiff(t1, t2, verbose_level=0), indent=2)
186186
{'values_changed': {'root[2]': {'new_value': 4, 'old_value': 2}}}
187187
188188
Item added and/or removed
189-
>>> t1 = {1:1, 2:2, 3:3, 4:4}
190-
>>> t2 = {1:1, 2:4, 3:3, 5:5, 6:6}
189+
>>> t1 = {1:1, 3:3, 4:4}
190+
>>> t2 = {1:1, 3:3, 5:5, 6:6}
191191
>>> ddiff = DeepDiff(t1, t2)
192192
>>> pprint (ddiff)
193193
{'dictionary_item_added': {'root[5]', 'root[6]'},
194-
'dictionary_item_removed': {'root[4]'},
195-
'values_changed': {'root[2]': {'new_value': 4, 'old_value': 2}}}
194+
'dictionary_item_removed': {'root[4]'}}
195+
196+
Set verbose level to 2 in order to see the added or removed items with their values
197+
>>> t1 = {1:1, 3:3, 4:4}
198+
>>> t2 = {1:1, 3:3, 5:5, 6:6}
199+
>>> ddiff = DeepDiff(t1, t2, verbose_level=2)
200+
>>> pprint(ddiff, indent=2)
201+
{ 'dictionary_item_added': {'root[5]': 5, 'root[6]': 6},
202+
'dictionary_item_removed': {'root[4]': 4}}
196203
197204
String difference
198205
>>> t1 = {1:1, 2:2, 3:3, 4:{"a":"hello", "b":"world"}}
@@ -247,6 +254,13 @@ class DeepDiff(RemapDict):
247254
'old_type': <class 'list'>,
248255
'old_value': [1, 2, 3]}}}
249256
257+
And if you don't care about the value of items that have changed type, please set verbose level to 0
258+
>>> t1 = {1:1, 2:2, 3:3}
259+
>>> t2 = {1:1, 2:"2", 3:3}
260+
>>> pprint(DeepDiff(t1, t2, verbose_level=0), indent=2)
261+
{ 'type_changes': { 'root[2]': { 'new_type': <class 'str'>,
262+
'old_type': <class 'int'>}}}
263+
250264
List difference
251265
>>> t1 = {1:1, 2:2, 3:3, 4:{"a":"hello", "b":[1, 2, 3, 4]}}
252266
>>> t2 = {1:1, 2:2, 3:3, 4:{"a":"hello", "b":[1, 2]}}

docs/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Install from PyPi::
2020

2121

2222
**************
23-
DeepDiff 1.7.0
23+
DeepDiff 2.0.0
2424
**************
2525

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

47-
- v1-7-0: Deep Set comparison
47+
- v2-0-0: Exclusion patterns better coverage. Updating docs.
48+
- v1-8-0: Exclusion patterns.
49+
- v1-7-0: Deep Set comparison.
4850
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
4951
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
5052
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.

0 commit comments

Comments
 (0)