| from __future__ import annotations | |
| from pathlib import Path | |
| from typing import Any, Dict | |
| import yaml | |
| def load_config(path: str | Path) -> Dict[str, Any]: | |
| """Load YAML config into a plain dictionary.""" | |
| config_path = Path(path) | |
| with config_path.open("r", encoding="utf-8") as handle: | |
| data = yaml.safe_load(handle) or {} | |
| if not isinstance(data, dict): | |
| raise ValueError(f"Config at {config_path} must be a mapping") | |
| return data | |