From ced16da5769f2e98652d739c9ce81f5399d3d36b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:31:09 +0100 Subject: [PATCH] Adjust type hints for VacuumEntityFeature (#82269) --- homeassistant/components/tuya/vacuum.py | 1 - homeassistant/components/vacuum/__init__.py | 4 ++-- pylint/plugins/hass_enforce_type_hints.py | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/tuya/vacuum.py b/homeassistant/components/tuya/vacuum.py index d17452b11c6..27fe764b1e3 100644 --- a/homeassistant/components/tuya/vacuum.py +++ b/homeassistant/components/tuya/vacuum.py @@ -83,7 +83,6 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity): """Init Tuya vacuum.""" super().__init__(device, device_manager) - self._attr_supported_features = 0 self._attr_fan_speed_list = [] self._attr_supported_features |= VacuumEntityFeature.SEND_COMMAND diff --git a/homeassistant/components/vacuum/__init__.py b/homeassistant/components/vacuum/__init__.py index 6a7efe4fa56..708c511a85c 100644 --- a/homeassistant/components/vacuum/__init__.py +++ b/homeassistant/components/vacuum/__init__.py @@ -180,10 +180,10 @@ class _BaseVacuum(Entity): _attr_battery_level: int | None = None _attr_fan_speed: str | None = None _attr_fan_speed_list: list[str] - _attr_supported_features: int + _attr_supported_features: VacuumEntityFeature | int = 0 @property - def supported_features(self) -> int: + def supported_features(self) -> VacuumEntityFeature | int: """Flag vacuum cleaner features that are supported.""" return self._attr_supported_features diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index ade51cbe97d..e454be1ee22 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -2394,6 +2394,10 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { function_name="fan_speed_list", return_type="list[str]", ), + TypeHintMatch( + function_name="supported_features", + return_type=["VacuumEntityFeature", "int"], + ), TypeHintMatch( function_name="stop", kwargs_type="Any",