1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Mark device_class type hints as compulsory in various platforms (#160929)

This commit is contained in:
epenet
2026-01-14 15:47:17 +01:00
committed by GitHub
parent 77dd4189b1
commit 79c4164e03
2 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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",