Split out yaml loading into own package (#140683)

* Split out yaml loading into library

* Code review

* Code review

* Fix check config script
This commit is contained in:
Jan-Philipp Benecke
2025-03-16 03:26:18 +01:00
committed by GitHub
parent 3a6ddcf428
commit 7b9ea63f17
15 changed files with 71 additions and 678 deletions

View File

@@ -12,6 +12,9 @@ import os
from typing import Any
from unittest.mock import patch
from annotatedyaml import loader as yaml_loader
from annotatedyaml.loader import Secrets
from homeassistant import core, loader
from homeassistant.config import get_default_config_dir
from homeassistant.config_entries import ConfigEntries
@@ -23,7 +26,6 @@ from homeassistant.helpers import (
issue_registry as ir,
)
from homeassistant.helpers.check_config import async_check_ha_config_file
from homeassistant.util.yaml import Secrets, loader as yaml_loader
# mypy: allow-untyped-calls, allow-untyped-defs
@@ -31,9 +33,9 @@ REQUIREMENTS = ("colorlog==6.8.2",)
_LOGGER = logging.getLogger(__name__)
MOCKS: dict[str, tuple[str, Callable]] = {
"load": ("homeassistant.util.yaml.loader.load_yaml", yaml_loader.load_yaml),
"load": ("annotatedyaml.loader.load_yaml", yaml_loader.load_yaml),
"load*": ("homeassistant.config.load_yaml_dict", yaml_loader.load_yaml_dict),
"secrets": ("homeassistant.util.yaml.loader.secret_yaml", yaml_loader.secret_yaml),
"secrets": ("annotatedyaml.loader.secret_yaml", yaml_loader.secret_yaml),
}
PATCHES: dict[str, Any] = {}