From 026e1635cc3a85deda3c8f4442a9623760e9046d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 17 Apr 2022 20:59:31 -1000 Subject: [PATCH] Rename async_process_integration_platform to async_process_integration_platform_for_component (#70217) --- homeassistant/helpers/integration_platform.py | 12 ++++++------ tests/helpers/test_integration_platform.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/homeassistant/helpers/integration_platform.py b/homeassistant/helpers/integration_platform.py index d6d44eb6858..f2eea1e3965 100644 --- a/homeassistant/helpers/integration_platform.py +++ b/homeassistant/helpers/integration_platform.py @@ -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 diff --git a/tests/helpers/test_integration_platform.py b/tests/helpers/test_integration_platform.py index b2105f30706..a9d0da0b849 100644 --- a/tests/helpers/test_integration_platform.py +++ b/tests/helpers/test_integration_platform.py @@ -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")