Collapse normalize_value function into recursively_normalize_values

This commit is contained in:
Adam Goldsmith 2023-03-12 12:49:46 -04:00
parent ae80647870
commit 3aa0681227

View File

@ -51,12 +51,6 @@ def shouldRecurse(obj, subobject_prop):
and obj.get('Name') not in ('Deck', 'DeckCustom') \
and len(obj[subobject_prop]) > 1
def normalize_value(value):
rounded = round(value, 2)
if rounded == -0.0:
return 0.0
else:
return rounded
def recursively_normalize_values(d):
if isinstance(d, dict):
@ -64,10 +58,15 @@ def recursively_normalize_values(d):
elif isinstance(d, list):
return [recursively_normalize_values(value) for value in d]
elif isinstance(d, float):
return normalize_value(d)
rounded = round(d, 2)
if rounded == -0.0:
return 0.0
else:
return rounded
else:
return d
def recursivelyUnpackObject(parent_dir, obj,
subobject_prop='ContainedObjects', base_name=None):
def convertObjectsToIncludes(objects):