Skip to content

Commit f3ee1f9

Browse files
committedOct 13, 2021
adding more examples
1 parent cc0d0ab commit f3ee1f9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎deepdiff/operator.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44

55
class BaseOperator:
6-
__operator_name__ = "__base__"
76

87
def __init__(self, regex_paths=None, types=None):
98
if regex_paths:

‎docs/custom.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ To define an custom operator, you just need to inherit a *BaseOperator* and
152152

153153
In fact you don't even have to subclass the base operator.
154154

155-
This is all that is expected from the operator:
155+
This is all that is expected from the operator, a match function that takes the level and a give_up_diffing function that takes the level and diff_instance.
156+
157+
158+
.. code-block:: python
156159
157160
def _use_custom_operator(self, level):
158161
"""
@@ -173,7 +176,6 @@ This is all that is expected from the operator:
173176
return False
174177
175178
176-
177179
**Example 1: An operator that mapping L2:distance as diff criteria and reports the distance**
178180

179181
>>> import math
@@ -251,7 +253,7 @@ This is all that is expected from the operator:
251253
{'dictionary_item_added': [root.dict['a'], root.dict['b']], 'dictionary_item_removed': [root.dict['c'], root.dict['d']], 'values_changed': {"root.dict['list'][3]": {'new_value': 4, 'old_value': 2}}}
252254
>>>
253255

254-
**Example 3: Only diff certain path's**
256+
**Example 3: Only diff certain paths**
255257

256258
>>> from deepdiff import DeepDiff
257259
>>> class MyOperator:

0 commit comments

Comments
 (0)
Please sign in to comment.