Traverse and validate existence of a config path. Recursively checks if a path exists in the configuration dictionary. Does not retrieve values, only validates path existence. Args: config: Configuration dictionary to traverse config_path: List of keys forming the path
(config: dict, config_path: list[str])
| 22 | |
| 23 | |
| 24 | def traverse_config_path(config: dict, config_path: list[str]) -> bool: |
| 25 | """Traverse and validate existence of a config path. |
| 26 | |
| 27 | Recursively checks if a path exists in the configuration dictionary. |
| 28 | Does not retrieve values, only validates path existence. |
| 29 | |
| 30 | Args: |
| 31 | config: Configuration dictionary to traverse |
| 32 | config_path: List of keys forming the path to check |
| 33 | |
| 34 | Returns: |
| 35 | True if path exists and is valid, False otherwise |
| 36 | """ |
| 37 | if len(config_path) == 0: |
| 38 | return True |
| 39 | if not (config and config_path[0] in config): |
| 40 | return False |
| 41 | return traverse_config_path(config[config_path[0]], config_path=config_path[1:]) |
| 42 | |
| 43 | |
| 44 | def get_config_value(config: dict, config_path: list[str]) -> Any: |
no outgoing calls
no test coverage detected