Rename async_process_integration_platform to async_process_integration_platform_for_component (#70217)
parent
a9a5645255
commit
026e1635cc
|
@ -25,7 +25,7 @@ class IntegrationPlatform:
|
|||
seen_components: set[str]
|
||||
|
||||
|
||||
async def _async_process_single_integration_platform(
|
||||
async def _async_process_single_integration_platform_component(
|
||||
hass: HomeAssistant, component_name: str, integration_platform: IntegrationPlatform
|
||||
) -> None:
|
||||
"""Process a single integration platform."""
|
||||
|
@ -55,10 +55,10 @@ async def _async_process_single_integration_platform(
|
|||
)
|
||||
|
||||
|
||||
async def async_process_integration_platform(
|
||||
async def async_process_integration_platform_for_component(
|
||||
hass: HomeAssistant, component_name: str
|
||||
) -> None:
|
||||
"""Process integration platforms on demand.
|
||||
"""Process integration platforms on demand for a component.
|
||||
|
||||
This function will load the integration platforms
|
||||
for an integration instead of waiting for the EVENT_COMPONENT_LOADED
|
||||
|
@ -77,7 +77,7 @@ async def async_process_integration_platform(
|
|||
]
|
||||
await asyncio.gather(
|
||||
*[
|
||||
_async_process_single_integration_platform(
|
||||
_async_process_single_integration_platform_component(
|
||||
hass, component_name, integration_platform
|
||||
)
|
||||
for integration_platform in integration_platforms
|
||||
|
@ -100,7 +100,7 @@ async def async_process_integration_platforms(
|
|||
"""Handle a new component loaded."""
|
||||
comp = event.data[ATTR_COMPONENT]
|
||||
if "." not in comp:
|
||||
await async_process_integration_platform(hass, comp)
|
||||
await async_process_integration_platform_for_component(hass, comp)
|
||||
|
||||
hass.bus.async_listen(EVENT_COMPONENT_LOADED, _async_component_loaded)
|
||||
|
||||
|
@ -114,7 +114,7 @@ async def async_process_integration_platforms(
|
|||
):
|
||||
await asyncio.gather(
|
||||
*[
|
||||
_async_process_single_integration_platform(
|
||||
_async_process_single_integration_platform_component(
|
||||
hass, comp, integration_platform
|
||||
)
|
||||
for comp in top_level_components
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.helpers.integration_platform import (
|
||||
async_process_integration_platform,
|
||||
async_process_integration_platform_for_component,
|
||||
)
|
||||
from homeassistant.setup import ATTR_COMPONENT, EVENT_COMPONENT_LOADED
|
||||
|
||||
|
@ -40,7 +40,7 @@ async def test_process_integration_platforms(hass):
|
|||
assert processed[1][1] == event_platform
|
||||
|
||||
# Verify we only process the platform once if we call it manually
|
||||
await hass.helpers.integration_platform.async_process_integration_platform(
|
||||
await hass.helpers.integration_platform.async_process_integration_platform_for_component(
|
||||
hass, "event"
|
||||
)
|
||||
assert len(processed) == 2
|
||||
|
@ -48,6 +48,6 @@ async def test_process_integration_platforms(hass):
|
|||
|
||||
async def test_process_integration_platforms_none_loaded(hass):
|
||||
"""Test processing integrations with none loaded."""
|
||||
# Verify we can call async_process_integration_platform
|
||||
# Verify we can call async_process_integration_platform_for_component
|
||||
# when there are none loaded and it does not throw
|
||||
await async_process_integration_platform(hass, "any")
|
||||
await async_process_integration_platform_for_component(hass, "any")
|
||||
|
|
Loading…
Reference in New Issue