osc.utils.to_dotlist
- to_dotlist(d, prf=())[source]
Iterate over a flattened dict using dot-separated keys.
- Parameters
Notes
The type of
d
can be defined asStringDict
, but it clashes with Sphynx:StringDict = Mapping[str, Union[Any, StringDict]]
.Examples
Flatten a dict:
>>> print(*to_dotlist({'a': {'b': {}, 'c': 1, 'd': [2]}, 'x': []}), sep="\n") ('a.b', {}) ('a.c', 1) ('a.d', [2]) ('x', [])