From 91005f4694aa706d9401e5858ff32f3e4eef1cb7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 16 Aug 2022 11:16:33 +0200 Subject: [PATCH] Update pylint plugin to use TriggerActionType (#76819) --- pylint/plugins/hass_enforce_type_hints.py | 4 ++-- pylint/plugins/hass_imports.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 158848ba4d4..35862742b18 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -337,8 +337,8 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = { arg_types={ 0: "HomeAssistant", 1: "ConfigType", - # 2: "AutomationActionType", # AutomationActionType is deprecated -> TriggerActionType - # 3: "AutomationTriggerInfo", # AutomationTriggerInfo is deprecated -> TriggerInfo + 2: "TriggerActionType", + 3: "TriggerInfo", }, return_type="CALLBACK_TYPE", ), diff --git a/pylint/plugins/hass_imports.py b/pylint/plugins/hass_imports.py index de981ab6a6d..caea0451f4d 100644 --- a/pylint/plugins/hass_imports.py +++ b/pylint/plugins/hass_imports.py @@ -38,6 +38,20 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { constant=re.compile(r"^FORMAT_(\w*)$"), ), ], + "homeassistant.components.automation": [ + ObsoleteImportMatch( + reason="replaced by TriggerActionType from helpers.trigger", + constant=re.compile(r"^AutomationActionType$") + ), + ObsoleteImportMatch( + reason="replaced by TriggerData from helpers.trigger", + constant=re.compile(r"^AutomationTriggerData$") + ), + ObsoleteImportMatch( + reason="replaced by TriggerInfo from helpers.trigger", + constant=re.compile(r"^AutomationTriggerInfo$") + ), + ], "homeassistant.components.binary_sensor": [ ObsoleteImportMatch( reason="replaced by BinarySensorDeviceClass enum",