Watched: combine_watched_dicts check types

Signed-off-by: Luigi311 <git@luigi311.com>
This commit is contained in:
Luigi311
2023-12-10 12:20:53 -07:00
parent b8b627be1a
commit bdf6476689

View File

@@ -6,11 +6,17 @@ from src.library import generate_library_guids_dict
def combine_watched_dicts(dicts: list): def combine_watched_dicts(dicts: list):
# Ensure that the input is a list of dictionaries
if not all(isinstance(d, dict) for d in dicts):
raise ValueError("Input must be a list of dictionaries")
combined_dict = {} combined_dict = {}
for single_dict in dicts: for single_dict in dicts:
for key, value in single_dict.items(): for key, value in single_dict.items():
if key not in combined_dict: if key not in combined_dict:
combined_dict[key] = {} combined_dict[key] = {}
for subkey, subvalue in value.items(): for subkey, subvalue in value.items():
if subkey in combined_dict[key]: if subkey in combined_dict[key]:
# If the subkey already exists in the combined dictionary, # If the subkey already exists in the combined dictionary,