Use isinstance()
instead of type() ==
This commit is contained in:
parent
fa4d07b628
commit
ae80647870
@ -59,11 +59,11 @@ def normalize_value(value):
|
||||
return rounded
|
||||
|
||||
def recursively_normalize_values(d):
|
||||
if type(d) == dict:
|
||||
if isinstance(d, dict):
|
||||
return {key: recursively_normalize_values(value) for key, value in d.items()}
|
||||
elif type(d) == list:
|
||||
elif isinstance(d, list):
|
||||
return [recursively_normalize_values(value) for value in d]
|
||||
elif type(d) == float:
|
||||
elif isinstance(d, float):
|
||||
return normalize_value(d)
|
||||
else:
|
||||
return d
|
||||
|
Loading…
Reference in New Issue
Block a user