21 lines
543 B
Python
21 lines
543 B
Python
# sanguo_data/config.py
|
|
from dataclasses import dataclass
|
|
import yaml
|
|
|
|
@dataclass(frozen=True)
|
|
class DataConfig:
|
|
data_paths: dict
|
|
data_sources: dict
|
|
validation: dict
|
|
performance: dict
|
|
|
|
def load_config(path: str) -> DataConfig:
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
raw = yaml.safe_load(f)
|
|
return DataConfig(
|
|
data_paths=raw.get("data_paths", {}),
|
|
data_sources=raw.get("data_sources", {}),
|
|
validation=raw.get("validation", {}),
|
|
performance=raw.get("performance", {}),
|
|
)
|