diff --git a/binarycpython/utils/dicts.py b/binarycpython/utils/dicts.py index a873117ea2b7a064967b7e7befaf3d636ba51591..eeb2a059172b9a6454cb9589337c534f7f4c157a 100644 --- a/binarycpython/utils/dicts.py +++ b/binarycpython/utils/dicts.py @@ -510,6 +510,21 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: ): new_dict[key] = merge_dicts(dict_1[key], dict_2[key]) + # one key is None, just use the other + elif dict_1[key] is None: + try: + new_dict[key] = dict_2[key] + except: + msg = f"{key}: Failed to set from {dict_2[key]} when other key was of NoneType " + raise ValueError(msg) from e + + elif dict_1[key] is None: + try: + new_dict[key] = dict_1[key] + except: + msg = f"{key}: Failed to set from {dict_1[key]} when other key was of NoneType " + raise ValueError(msg) from e + # string-int clash : convert both to ints and save elif ( isinstance(dict_1[key], str) @@ -525,6 +540,7 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: ) raise ValueError(msg) from e + # string-float clash : convert both to floats and save elif ( isinstance(dict_1[key], str)