Add a simple add key entry to dictionary

This commit is contained in:
Clemens Schwaighofer
2025-10-23 15:31:52 +09:00
parent bf83c1c394
commit fe69530b38
2 changed files with 32 additions and 1 deletions

View File

@@ -82,4 +82,22 @@ def mask(
for key, value in data_set.items()
}
def set_entry(dict_set: dict[str, Any], key: str, value_set: Any) -> dict[str, Any]:
"""
set a new entry in the dict set
Arguments:
key {str} -- _description_
dict_set {dict[str, Any]} -- _description_
value_set {Any} -- _description_
Returns:
dict[str, Any] -- _description_
"""
if not dict_set.get(key):
dict_set[key] = {}
dict_set[key] = value_set
return dict_set
# __END__