From b8660b42486cc7b90a8bd00d82b345aff190b448 Mon Sep 17 00:00:00 2001 From: abmantis Date: Wed, 1 Oct 2025 22:12:51 +0100 Subject: [PATCH] Rename callback type --- homeassistant/components/zwave_js/triggers/event.py | 6 +++--- homeassistant/components/zwave_js/triggers/value_updated.py | 6 +++--- homeassistant/helpers/trigger.py | 4 ++-- tests/helpers/test_trigger.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/zwave_js/triggers/event.py b/homeassistant/components/zwave_js/triggers/event.py index daacbc323fb..d203550898c 100644 --- a/homeassistant/components/zwave_js/triggers/event.py +++ b/homeassistant/components/zwave_js/triggers/event.py @@ -23,8 +23,8 @@ from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers.automation import move_top_level_schema_fields_to_options from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.trigger import ( - RunTriggerActionCallback, Trigger, + TriggerActionRunnerCallback, TriggerConfig, ) from homeassistant.helpers.typing import ConfigType @@ -131,7 +131,7 @@ class EventTrigger(Trigger): _event_name: str _event_data_filter: dict _unsubs: list[Callable] - _action_runner: RunTriggerActionCallback + _action_runner: TriggerActionRunnerCallback @classmethod async def async_validate_complete_config( @@ -175,7 +175,7 @@ class EventTrigger(Trigger): self._options = config.options async def async_attach_runner( - self, run_action: RunTriggerActionCallback + self, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Attach a trigger.""" dev_reg = dr.async_get(self._hass) diff --git a/homeassistant/components/zwave_js/triggers/value_updated.py b/homeassistant/components/zwave_js/triggers/value_updated.py index a5703990694..65c6f9e276a 100644 --- a/homeassistant/components/zwave_js/triggers/value_updated.py +++ b/homeassistant/components/zwave_js/triggers/value_updated.py @@ -17,8 +17,8 @@ from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers.automation import move_top_level_schema_fields_to_options from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.trigger import ( - RunTriggerActionCallback, Trigger, + TriggerActionRunnerCallback, TriggerConfig, ) from homeassistant.helpers.typing import ConfigType @@ -93,7 +93,7 @@ async def async_validate_trigger_config( async def async_attach_trigger( - hass: HomeAssistant, options: ConfigType, run_action: RunTriggerActionCallback + hass: HomeAssistant, options: ConfigType, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Listen for state changes based on configuration.""" dev_reg = dr.async_get(hass) @@ -232,7 +232,7 @@ class ValueUpdatedTrigger(Trigger): self._options = config.options async def async_attach_runner( - self, run_action: RunTriggerActionCallback + self, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Attach a trigger.""" return await async_attach_trigger(self._hass, self._options, run_action) diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index 2163ee44c35..85e9d97819e 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -237,7 +237,7 @@ class Trigger(abc.ABC): @abc.abstractmethod async def async_attach_runner( - self, run_action: RunTriggerActionCallback + self, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Attach the trigger to an action runner.""" @@ -277,7 +277,7 @@ class TriggerConfig: options: dict[str, Any] | None = None -class RunTriggerActionCallback(Protocol): +class TriggerActionRunnerCallback(Protocol): """Protocol type for the trigger action runner helper callback.""" @callback diff --git a/tests/helpers/test_trigger.py b/tests/helpers/test_trigger.py index 317f60b5ef0..22042ff7894 100644 --- a/tests/helpers/test_trigger.py +++ b/tests/helpers/test_trigger.py @@ -23,8 +23,8 @@ from homeassistant.helpers.automation import move_top_level_schema_fields_to_opt from homeassistant.helpers.trigger import ( DATA_PLUGGABLE_ACTIONS, PluggableAction, - RunTriggerActionCallback, Trigger, + TriggerActionRunnerCallback, _async_get_trigger_platform, async_initialize_triggers, async_validate_trigger_config, @@ -464,7 +464,7 @@ async def test_platform_multiple_triggers(hass: HomeAssistant) -> None: """Mock trigger 1.""" async def async_attach_runner( - self, run_action: RunTriggerActionCallback + self, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Attach a trigger.""" run_action("trigger 1 desc", {"extra": "test_trigger_1"}) @@ -473,7 +473,7 @@ async def test_platform_multiple_triggers(hass: HomeAssistant) -> None: """Mock trigger 2.""" async def async_attach_runner( - self, run_action: RunTriggerActionCallback + self, run_action: TriggerActionRunnerCallback ) -> CALLBACK_TYPE: """Attach a trigger.""" run_action("trigger 2 desc", {"extra": "test_trigger_2"})