Spaces:
Running
Running
File size: 597 Bytes
590a604 ee1a8a3 ba4cb76 1fbc47b ba4cb76 1fbc47b ba4cb76 2286a5e ba4cb76 1fbc47b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
"""
Configuration utilities for LexiMind.
Provides YAML configuration loading with validation.
Author: Oliver Perrin
Date: December 2025
"""
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict
import yaml
@dataclass
class Config:
data: Dict[str, Any]
def load_yaml(path: str) -> Config:
with Path(path).open("r", encoding="utf-8") as handle:
content = yaml.safe_load(handle)
if not isinstance(content, dict):
raise ValueError(f"YAML configuration '{path}' must contain a mapping at the root")
return Config(data=content)
|