Skip to content

flatten_config ​

python
flatten_config(config: Any, prefix: str = '') -> dict[str, Any]

Flatten a configuration object (Pydantic model, dict, list, or scalar) into a single-level dictionary.

Nested models and dicts use '.' as a separator. Lists and Schedules use '.index.' as a separator.

Parameters:

  • config (Any) – The configuration object to flatten.
  • prefix (str) – The prefix to prepended to keys.

Returns:

  • dict[str, Any] – A flattened dictionary of parameters.

Source