Refactor AI daily report pipeline
This commit is contained in:
19
ai_daily_report/config.py
Normal file
19
ai_daily_report/config.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from .models import SourceConfig
|
||||
from .pipeline import _source_config_from_dict
|
||||
|
||||
|
||||
def load_json(path: Path) -> Any:
|
||||
return json.loads(path.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
def load_source_configs(path: Path) -> list[SourceConfig]:
|
||||
raw = load_json(path)
|
||||
if not isinstance(raw, list):
|
||||
raise ValueError("sources config must be a list")
|
||||
return [_source_config_from_dict(item) for item in raw]
|
||||
Reference in New Issue
Block a user