We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6500318 commit 1636e5bCopy full SHA for 1636e5b
gendiff/search_of_the_diff.py
@@ -0,0 +1,17 @@
1
+import json
2
+
3
+def search_diff(value1, value2):
4
+ result = {}
5
+ all_keys = sorted(list(value1.keys() | value2.keys()))
6
+ for key in all_keys:
7
+ if key in value1 and key not in value2:
8
+ result[f'- {key}'] = value1.get(key)
9
+ elif key in value1 and key in value2:
10
+ if value1[key] == value2[key]:
11
+ result[f' {key}'] = value1.get(key)
12
+ else:
13
14
+ result[f'+ {key}'] = value2.get(key)
15
+ elif key not in value1 and key in value2:
16
17
+ return json.dumps(result)
0 commit comments