Load configuration from file or return defaults.
(self)
| 62 | self._config: Dict[str, Any] = self._load_config() |
| 63 | |
| 64 | def _load_config(self) -> Dict[str, Any]: |
| 65 | """Load configuration from file or return defaults.""" |
| 66 | if self.config_file.exists(): |
| 67 | try: |
| 68 | with open(self.config_file, 'r') as f: |
| 69 | user_config = json.load(f) |
| 70 | # Merge with defaults |
| 71 | return self._merge_configs(DEFAULT_CONFIG, user_config) |
| 72 | except (json.JSONDecodeError, IOError) as e: |
| 73 | print(f"Warning: Could not load config file: {e}") |
| 74 | return DEFAULT_CONFIG.copy() |
| 75 | return DEFAULT_CONFIG.copy() |
| 76 | |
| 77 | def _merge_configs(self, base: Dict, override: Dict) -> Dict: |
| 78 | """Recursively merge override config into base config.""" |
no test coverage detected