little refactoring done
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -131,9 +132,10 @@ class RunConfigModel:
|
||||
@classmethod
|
||||
def load_from_path(cls, path: Path) -> RunConfigModel:
|
||||
"""Load JSON file from disk and decode into model."""
|
||||
from python_app.models.run_config_codec import load_run_config
|
||||
|
||||
return load_run_config(path)
|
||||
payload = json.loads(path.read_text(encoding="utf-8"))
|
||||
if not isinstance(payload, dict):
|
||||
raise ValueError(f"Config root must be JSON object: {path}")
|
||||
return cls.from_dict(payload)
|
||||
|
||||
def clone(self) -> RunConfigModel:
|
||||
"""Create deep copy through codec round-trip."""
|
||||
|
||||
Reference in New Issue
Block a user