Remove more useless manifest truthiness checks in hassfest (#82914)

This commit is contained in:
Aarni Koskela 2022-11-29 22:57:58 +02:00 committed by GitHub
parent 205a2ee215
commit 16fc2972d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View file

@ -49,10 +49,7 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config)
for domain in sorted(integrations): for domain in sorted(integrations):
integration = integrations[domain] integration = integrations[domain]
if ( if integration.integration_type == "virtual":
not integration.manifest
or integration.manifest.get("integration_type") == "virtual"
):
continue continue
codeowners = integration.manifest["codeowners"] codeowners = integration.manifest["codeowners"]

View file

@ -17,7 +17,7 @@ def _validate_integration(config: Config, integration: Integration) -> None:
config_flow_file = integration.path / "config_flow.py" config_flow_file = integration.path / "config_flow.py"
if not config_flow_file.is_file(): if not config_flow_file.is_file():
if (integration.manifest or {}).get("config_flow"): if integration.manifest.get("config_flow"):
integration.add_error( integration.add_error(
"config_flow", "config_flow",
"Config flows need to be defined in the file config_flow.py", "Config flows need to be defined in the file config_flow.py",
@ -149,7 +149,7 @@ def _generate_integrations(
primary_domains = { primary_domains = {
domain domain
for domain, integration in integrations.items() for domain, integration in integrations.items()
if integration.manifest and domain not in brand_integration_domains if domain not in brand_integration_domains
} }
# Add all brands to the set # Add all brands to the set
primary_domains |= set(brands) primary_domains |= set(brands)

View file

@ -292,7 +292,7 @@ def validate_version(integration: Integration) -> None:
Will be removed when the version key is no longer optional for custom integrations. Will be removed when the version key is no longer optional for custom integrations.
""" """
if not (integration.manifest and integration.manifest.get("version")): if not integration.manifest.get("version"):
integration.add_error("manifest", "No 'version' key in the manifest file.") integration.add_error("manifest", "No 'version' key in the manifest file.")
return return