cli: improve set_or_update_a_value

This commit is contained in:
Sina Atalay
2024-07-19 17:12:04 +03:00
parent 14d850b1bf
commit e01b00c0cf

View File

@@ -76,7 +76,13 @@ def set_or_update_a_value(
if isinstance(updated_dict, list):
first_key = int(first_key)
sub_dictionary = updated_dict[first_key] # type: ignore
if first_key in updated_dict:
# Key exists, get the sub dictionary:
sub_dictionary = updated_dict[first_key] # type: ignore
else:
# Key does not exist, create a new sub dictionary:
sub_dictionary = dict()
updated_sub_dict = set_or_update_a_value(dictionary, key, value, sub_dictionary)
updated_dict[first_key] = updated_sub_dict # type: ignore