(path: Path)
| 28 | |
| 29 | |
| 30 | def _load_yaml_file(path: Path) -> dict[str, Any]: |
| 31 | try: |
| 32 | import yaml |
| 33 | except ImportError as exc: |
| 34 | raise ConfigError("PyYAML is required to load YAML config files.") from exc |
| 35 | |
| 36 | with path.open("r", encoding="utf-8") as stream: |
| 37 | data = yaml.safe_load(stream) or {} |
| 38 | if not isinstance(data, dict): |
| 39 | raise ConfigError(f"Config file must contain a mapping: {path}") |
| 40 | return data |
| 41 | |
| 42 | |
| 43 | def _coerce_bool(value: Any, default: bool = False) -> bool: |
no test coverage detected