mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Minor tweaks of hassfest and loader.py (#78929)
This commit is contained in:
parent
bbe19e6255
commit
27599ea0ee
@ -129,7 +129,7 @@ class Manifest(TypedDict, total=False):
|
|||||||
name: str
|
name: str
|
||||||
disabled: str
|
disabled: str
|
||||||
domain: str
|
domain: str
|
||||||
integration_type: Literal["integration", "helper"]
|
integration_type: Literal["integration", "hardware", "helper"]
|
||||||
dependencies: list[str]
|
dependencies: list[str]
|
||||||
after_dependencies: list[str]
|
after_dependencies: list[str]
|
||||||
requirements: list[str]
|
requirements: list[str]
|
||||||
@ -558,7 +558,7 @@ class Integration:
|
|||||||
return self.manifest.get("iot_class")
|
return self.manifest.get("iot_class")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def integration_type(self) -> Literal["integration", "helper"]:
|
def integration_type(self) -> Literal["integration", "hardware", "helper"]:
|
||||||
"""Return the integration type."""
|
"""Return the integration type."""
|
||||||
return self.manifest.get("integration_type", "integration")
|
return self.manifest.get("integration_type", "integration")
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ FLOWS = {}
|
|||||||
UNIQUE_ID_IGNORE = {"huawei_lte", "mqtt", "adguard"}
|
UNIQUE_ID_IGNORE = {"huawei_lte", "mqtt", "adguard"}
|
||||||
|
|
||||||
|
|
||||||
def validate_integration(config: Config, integration: Integration):
|
def _validate_integration(config: Config, integration: Integration):
|
||||||
"""Validate config flow of an integration."""
|
"""Validate config flow of an integration."""
|
||||||
config_flow_file = integration.path / "config_flow.py"
|
config_flow_file = integration.path / "config_flow.py"
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ def validate_integration(config: Config, integration: Integration):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate_and_validate(integrations: dict[str, Integration], config: Config):
|
def _generate_and_validate(integrations: dict[str, Integration], config: Config):
|
||||||
"""Validate and generate config flow data."""
|
"""Validate and generate config flow data."""
|
||||||
domains = {
|
domains = {
|
||||||
"integration": [],
|
"integration": [],
|
||||||
@ -80,7 +80,7 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config):
|
|||||||
if not integration.manifest or not integration.config_flow:
|
if not integration.manifest or not integration.config_flow:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
validate_integration(config, integration)
|
_validate_integration(config, integration)
|
||||||
|
|
||||||
domains[integration.integration_type].append(domain)
|
domains[integration.integration_type].append(domain)
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config):
|
|||||||
def validate(integrations: dict[str, Integration], config: Config):
|
def validate(integrations: dict[str, Integration], config: Config):
|
||||||
"""Validate config flow file."""
|
"""Validate config flow file."""
|
||||||
config_flow_path = config.root / "homeassistant/generated/config_flows.py"
|
config_flow_path = config.root / "homeassistant/generated/config_flows.py"
|
||||||
config.cache["config_flow"] = content = generate_and_validate(integrations, config)
|
config.cache["config_flow"] = content = _generate_and_validate(integrations, config)
|
||||||
|
|
||||||
if config.specific_integrations:
|
if config.specific_integrations:
|
||||||
return
|
return
|
||||||
|
@ -127,7 +127,7 @@ class Integration:
|
|||||||
self.errors.append(Error(*args, **kwargs))
|
self.errors.append(Error(*args, **kwargs))
|
||||||
|
|
||||||
def add_warning(self, *args: Any, **kwargs: Any) -> None:
|
def add_warning(self, *args: Any, **kwargs: Any) -> None:
|
||||||
"""Add an warning."""
|
"""Add a warning."""
|
||||||
self.warnings.append(Error(*args, **kwargs))
|
self.warnings.append(Error(*args, **kwargs))
|
||||||
|
|
||||||
def load_manifest(self) -> None:
|
def load_manifest(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user