From e9c59130250d9a5097c59b974110d431e95c5b98 Mon Sep 17 00:00:00 2001 From: Torben Nehmer Date: Fri, 4 Dec 2026 22:54:41 +0100 Subject: [PATCH] Make loader read_yaml public The baseline reader needs the same YAML dialect for old case files. Co-Authored-By: Claude Sonnet 5.5 --- src/chemenu/evals/loader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chemenu/evals/loader.py b/src/chemenu/evals/loader.py index ecec050..c000d34 100644 --- a/src/chemenu/evals/loader.py +++ b/src/chemenu/evals/loader.py @@ -34,7 +34,7 @@ for _first in "tTfF": _Loader.yaml_implicit_resolvers = _resolvers -def _read_yaml(path: Path) -> dict[str, Any]: +def read_yaml(path: Path) -> dict[str, Any]: try: text = path.read_text(encoding="utf-8-sig") except FileNotFoundError: @@ -70,7 +70,7 @@ def _resolve_output_model(spec: str, path: Path) -> type[BaseModel]: def load_eval_set(directory: Path) -> EvalSet: spec_path = directory / "eval.yaml" try: - spec = SetSpec.model_validate(_read_yaml(spec_path), strict=True) + spec = SetSpec.model_validate(read_yaml(spec_path), strict=True) except ValidationError as exc: raise EvalSetError( f"{spec_path}: invalid content: {describe_validation_error(exc)}" @@ -85,7 +85,7 @@ def load_eval_set(directory: Path) -> EvalSet: if not stray.name.startswith(".") and stray.suffix != ".yaml": raise EvalSetError(f"{stray}: case files must end in .yaml") for case_path in sorted(cases_dir.glob("*.yaml"), key=lambda p: p.stem): - data = _read_yaml(case_path) + data = read_yaml(case_path) if "id" in data: raise EvalSetError(f"{case_path}: invalid case: 'id' is the file name, not a field") try: