Add typing of EVENT_COMPONENT_LOADED to integration_platform helper (#110826)

This commit is contained in:
J. Nick Koston 2024-02-17 19:48:46 -06:00 committed by GitHub
parent 5d23a1f84f
commit 165d79b553
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,16 +10,18 @@ from types import ModuleType
from typing import Any from typing import Any
from homeassistant.const import EVENT_COMPONENT_LOADED from homeassistant.const import EVENT_COMPONENT_LOADED
from homeassistant.core import Event, HassJob, HomeAssistant, callback from homeassistant.core import HassJob, HomeAssistant, callback
from homeassistant.loader import ( from homeassistant.loader import (
Integration, Integration,
async_get_integrations, async_get_integrations,
async_get_loaded_integration, async_get_loaded_integration,
bind_hass, bind_hass,
) )
from homeassistant.setup import ATTR_COMPONENT from homeassistant.setup import ATTR_COMPONENT, EventComponentLoaded
from homeassistant.util.logging import catch_log_exception from homeassistant.util.logging import catch_log_exception
from .typing import EventType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DATA_INTEGRATION_PLATFORMS = "integration_platforms" DATA_INTEGRATION_PLATFORMS = "integration_platforms"
@ -61,10 +63,12 @@ def _get_platform(
@callback @callback
def _async_process_integration_platforms_for_component( def _async_process_integration_platforms_for_component(
hass: HomeAssistant, integration_platforms: list[IntegrationPlatform], event: Event hass: HomeAssistant,
integration_platforms: list[IntegrationPlatform],
event: EventType[EventComponentLoaded],
) -> None: ) -> None:
"""Process integration platforms for a component.""" """Process integration platforms for a component."""
component_name: str = event.data[ATTR_COMPONENT] component_name = event.data[ATTR_COMPONENT]
if "." in component_name: if "." in component_name:
return return