[deep_diff]
- use isinstance() instead of type() - make tests harder
This commit is contained in:
+7
-2
@@ -5,7 +5,7 @@ from copy import deepcopy
|
||||
def deep_diff(data, temp_data):
|
||||
new_data = {}
|
||||
for k in data.keys():
|
||||
if type(data[k]) == type({}):
|
||||
if isinstance(data[k], dict):
|
||||
if k not in temp_data:
|
||||
temp_data[k] = {}
|
||||
temp = deep_diff(data[k], temp_data[k])
|
||||
@@ -35,7 +35,12 @@ def deep_merge(d, u, only_existing=True):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open("results/WVWZZZE1ZMP010760/2024/10/18/vehicle_WVWZZZE1ZMP010760_2024-10-15T12-05-23-268Z.json", "r") as fp:
|
||||
files = [
|
||||
"results/WVWZZZE1ZMP010760/2024/10/18/vehicle_WVWZZZE1ZMP010760_2024-10-15T12-05-23-268Z.json",
|
||||
# "results/WVWZZZE1ZMP010760/2024/10/19/vehicle_WVWZZZE1ZMP010760_2024-10-19T00-00-34-353Z.json",
|
||||
]
|
||||
for file in files:
|
||||
with open(file, "r") as fp:
|
||||
src = json.load(fp)
|
||||
src_last = {}
|
||||
diffed_list = []
|
||||
|
||||
Reference in New Issue
Block a user