diff --git a/pyproject.toml b/pyproject.toml index 66d37ea..fbfe56a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ # MARK: Project info [project] name = "corelibs" -version = "0.12.2" +version = "0.12.3" description = "Collection of utils for Python scripts" readme = "README.md" requires-python = ">=3.13" diff --git a/src/corelibs/iterator_handling/dict_helpers.py b/src/corelibs/iterator_handling/dict_helpers.py index 89529f1..fe70d50 100644 --- a/src/corelibs/iterator_handling/dict_helpers.py +++ b/src/corelibs/iterator_handling/dict_helpers.py @@ -3,6 +3,9 @@ Dict helpers """ +from typing import Any + + def mask( data_set: dict[str, str], mask_keys: list[str] | None = None, @@ -34,4 +37,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__