Skip to content
Snippets Groups Projects
Commit b2a54baa authored by David Hendriks's avatar David Hendriks
Browse files

fixed bug. boolean has to be caught first, cause True is also seen as an int

parent 8b1f8ae7
No related branches found
No related tags found
No related merge requests found
...@@ -1136,7 +1136,11 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: ...@@ -1136,7 +1136,11 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
# dealt with by calling this function again. # dealt with by calling this function again.
else: else:
# ints # ints
if isinstance(dict_1[key], int) and isinstance(dict_2[key], int): # Booleans (has to be the type Bool, not just a 0 or 1)
if isinstance(dict_1[key], bool) and isinstance(dict_2[key], bool):
new_dict[key] = dict_1[key] or dict_2[key]
elif isinstance(dict_1[key], int) and isinstance(dict_2[key], int):
new_dict[key] = dict_1[key] + dict_2[key] new_dict[key] = dict_1[key] + dict_2[key]
# floats # floats
...@@ -1151,10 +1155,6 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict: ...@@ -1151,10 +1155,6 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
elif isinstance(dict_1[key], dict) and isinstance(dict_2[key], dict): elif isinstance(dict_1[key], dict) and isinstance(dict_2[key], dict):
new_dict[key] = merge_dicts(dict_1[key], dict_2[key]) new_dict[key] = merge_dicts(dict_1[key], dict_2[key])
# Booleans (has to be the type Bool, not just a 0 or 1)
elif isinstance(dict_1[key], bool) and isinstance(dict_2[key], bool):
new_dict[key] = dict_1[key] or dict_2[key]
else: else:
print( print(
"Object types {},{} not supported".format( "Object types {},{} not supported".format(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment