Skip to content

Commit 94ee32c

Browse files
committed
adding the support page
1 parent cb82e6c commit 94ee32c

File tree

4 files changed

+69
-10
lines changed

4 files changed

+69
-10
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ Authors in order of the contributions:
3636
- Tim Klein [timjklein36](https://github.com/timjklein36) for retaining the order of multiple dictionary items added via Delta.
3737
- Wilhelm Schürmann[wbsch](https://github.com/wbsch) for fixing the typo with yml files.
3838
- [lyz-code](https://github.com/lyz-code) for adding support for regular expressions in DeepSearch and strict_checking feature in DeepSearch.
39+
- [dtorres-sf](https://github.com/dtorres-sf)for adding the option for custom compare function

docs/authors.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Thanks to the following people for their contributions:
4343
- Tim Klein `timjklein36`_ for retaining the order of multiple dictionary items added via Delta
4444
- Wilhelm Schürmann `wbsch`_ for fixing the typo with yml files.
4545
- `lyz_code`_ for adding support for regular expressions in DeepSearch and strict_checking feature in DeepSearch.
46+
- `dtorres_sf`_ for adding the option for custom compare function
4647

4748

4849
.. _Sep Dehpour (Seperman): http://www.zepworks.com
@@ -77,6 +78,7 @@ Thanks to the following people for their contributions:
7778
.. _timjklein36: https://github.com/timjklein36
7879
.. _wbsch: https://github.com/wbsch
7980
.. _lyz_code: https://github.com/lyz-code
81+
.. _dtorres_sf: https://github.com/dtorres-sf
8082

8183

8284
Back to :doc:`/index`

docs/index.rst

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,51 @@ NOTE: Python 2 is not supported any more. DeepDiff v3.3.0 was the last version t
3939
What is New
4040
***********
4141

42-
DeepDiff 5.5.0
43-
--------------
42+
New In DeepDiff 5.5.0
43+
---------------------
4444

45-
1. New option called `iterable_compare_func` that takes a function pointer to compare two items. It function takes two parameters and should return `True` if it is a match, `False` if it is not a match or raise `CannotCompare` if it is unable to compare the two. If `CannotCompare` is raised then it will revert back to comparing in order. If `iterable_compare_func` is not provided or set to None the behavior defaults to comparing items in order.
46-
2. A new report item called `iterable_item_moved` this will only ever be added if there is a custom compare function.
45+
1. New option called `iterable_compare_func` that takes a function pointer to compare two items. It function takes two parameters and should return `True` if it is a match, `False` if it is not a match or raise `CannotCompare` if it is unable to compare the two. If `CannotCompare` is raised then it will revert back to comparing in order. If `iterable_compare_func` is not provided or set to None the behavior defaults to comparing items in order. A new report item called `iterable_item_moved` this will only ever be added if there is a custom compare function.
4746

48-
49-
50-
3. You can get the path() of item in the tree view in the list format instead of string representation by passing path(output_format='list')
47+
>>> from deepdiff import DeepDiff
48+
>>> from deepdiff.helper import CannotCompare
49+
>>>
50+
>>> t1 = [
51+
... {
52+
... 'id': 2,
53+
... 'value': [7, 8, 1]
54+
... },
55+
... {
56+
... 'id': 3,
57+
... 'value': [7, 8],
58+
... },
59+
... ]
60+
>>>
61+
>>> t2 = [
62+
... {
63+
... 'id': 2,
64+
... 'value': [7, 8]
65+
... },
66+
... {
67+
... 'id': 3,
68+
... 'value': [7, 8, 1],
69+
... },
70+
... ]
71+
>>>
72+
>>> DeepDiff(t1, t2)
73+
{'values_changed': {"root[0]['id']": {'new_value': 2, 'old_value': 1}, "root[0]['value'][0]": {'new_value': 7, 'old_value': 1}, "root[1]['id']": {'new_value': 3, 'old_value': 2}, "root[2]['id']": {'new_value': 1, 'old_value': 3}, "root[2]['value'][0]": {'new_value': 1, 'old_value': 7}}, 'iterable_item_added': {"root[0]['value'][1]": 8}, 'iterable_item_removed': {"root[2]['value'][1]": 8}}
74+
75+
Now let's use the custom compare function to guide DeepDiff in what to compare with what:
76+
77+
>>> def compare_func(x, y, level=None):
78+
... try:
79+
... return x['id'] == y['id']
80+
... except Exception:
81+
... raise CannotCompare() from None
82+
...
83+
>>> DeepDiff(t1, t2, iterable_compare_func=compare_func)
84+
{'iterable_item_added': {"root[2]['value'][2]": 1}, 'iterable_item_removed': {"root[1]['value'][2]": 1}}
85+
86+
2. You can get the path() of item in the tree view in the list format instead of string representation by passing path(output_format='list')
5187

5288
.. code:: python
5389
@@ -64,10 +100,10 @@ DeepDiff 5.5.0
64100
[4, 'b', 2]
65101
66102
67-
Deepdiff 5.5.0
68-
--------------
103+
New In Deepdiff 5.3.0
104+
---------------------
69105

70-
Deepdiff 5.5.0 comes with regular expressions in the DeepSearch and grep modules:
106+
Deepdiff 5.3.0 comes with regular expressions in the DeepSearch and grep modules:
71107

72108

73109
.. code:: python
@@ -173,6 +209,7 @@ References
173209
commandline
174210
changelog
175211
authors
212+
support
176213

177214

178215
Indices and tables

docs/support.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:doc:`/index`
2+
3+
Support
4+
=======
5+
6+
Hello,
7+
8+
This is Sep, the creator of DeepDiff. Thanks for using DeepDiff!
9+
If you find a bug please create a ticket on our `github repo`_
10+
11+
Please note that my time is very limited for support given my other commitments so it may take a while to get back to you. In case you need direct contact for a pressing issue, I can be reached via hello at zepworks . com email address for consulting.
12+
13+
Thank you!
14+
15+
Sep
16+
17+
.. _github repo: https://github.com/seperman/deepdiff
18+
19+
Back to :doc:`/index`

0 commit comments

Comments
 (0)