From 79c4164e033fcc577f2c057a0430ff11e717de73 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:47:17 +0100 Subject: [PATCH] Mark device_class type hints as compulsory in various platforms (#160929) --- homeassistant/components/geniushub/switch.py | 2 +- pylint/plugins/hass_enforce_type_hints.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/geniushub/switch.py b/homeassistant/components/geniushub/switch.py index 890ca1578be..874bd0cee7b 100644 --- a/homeassistant/components/geniushub/switch.py +++ b/homeassistant/components/geniushub/switch.py @@ -57,7 +57,7 @@ class GeniusSwitch(GeniusZone, SwitchEntity): """Representation of a Genius Hub switch.""" @property - def device_class(self): + def device_class(self) -> SwitchDeviceClass: """Return the class of this device, from component DEVICE_CLASSES.""" return SwitchDeviceClass.OUTLET diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 8e9bb6552a5..923b2d013bf 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -954,6 +954,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["ButtonDeviceClass", None], + mandatory=True, ), TypeHintMatch( function_name="press", @@ -1366,6 +1367,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["CoverDeviceClass", None], + mandatory=True, ), TypeHintMatch( function_name="current_cover_position", @@ -1991,6 +1993,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["MediaPlayerDeviceClass", None], + mandatory=True, ), TypeHintMatch( function_name="state", @@ -2334,6 +2337,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["NumberDeviceClass", None], + mandatory=True, ), TypeHintMatch( function_name="capability_attributes", @@ -2633,6 +2637,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["SwitchDeviceClass", None], + mandatory=True, ), ], ), @@ -2737,6 +2742,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="device_class", return_type=["UpdateDeviceClass", None], + mandatory=True, ), TypeHintMatch( function_name="in_progress",