improved logging
This commit is contained in:
@@ -5,11 +5,14 @@ from __future__ import annotations
|
||||
from copy import deepcopy
|
||||
from dataclasses import dataclass, field
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from python_app.models.run_config_model import RunConfigModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class GuiSwitchStateModel:
|
||||
@@ -159,7 +162,11 @@ class GuiProfileModel:
|
||||
|
||||
@classmethod
|
||||
def load_from_path(cls, path: Path) -> GuiProfileModel:
|
||||
"""Load JSON file from disk and decode into profile model."""
|
||||
"""Load a JSON file from disk and decode it into a profile model.
|
||||
|
||||
Raises ValueError when the file's JSON root is not an object.
|
||||
"""
|
||||
logger.debug("Loading GUI profile from %s", path)
|
||||
payload = json.loads(path.read_text(encoding="utf-8"))
|
||||
if not isinstance(payload, dict):
|
||||
raise ValueError(f"Config profile root must be JSON object: {path}")
|
||||
|
||||
Reference in New Issue
Block a user