simdb.database.models.utils module¶
-
simdb.database.models.utils.checked_get(data: dict[str, Any], key, expected_type: type, optional: bool =
False)[source]¶
-
simdb.database.models.utils.flatten_dict(data: dict[str, Any], prefix: str =
'', delim: str ='.') dict[str, Any][source]¶ Recursively flattens a nested dictionary, representing nested structures with keys delimited by a string, and lists with index suffixes.
- Example:
>>> flatten_dict({"a": {"b": 1}, "c": [2, {"d": 3}]}) {'a.b': 1, 'c#1': 2, 'c#2.d': 3}