QPromaQ's picture
Reset repository and upload final project (part 30)
504d922 verified
Raw
History Blame Contribute Delete
465 Bytes
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