Get a value from a nested dict using dotted key notation.
(d: dict, dotted_key: str, default: Any = None)
| 162 | |
| 163 | |
| 164 | def _get_nested(d: dict, dotted_key: str, default: Any = None) -> Any: |
| 165 | """Get a value from a nested dict using dotted key notation.""" |
| 166 | keys = dotted_key.split(".") |
| 167 | for key in keys: |
| 168 | if not isinstance(d, dict): |
| 169 | return default |
| 170 | d = d.get(key, default) # type: ignore[assignment] |
| 171 | if d is default: |
| 172 | return default |
| 173 | return d |
| 174 | |
| 175 | |
| 176 | def load_config_file(path: Optional[Path] = None) -> dict: |
no outgoing calls