From 3be750812daddf717c8edb9e4c90412047533cb1 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:17:50 +0100 Subject: [PATCH] Adjust type hints for UpdateEntityFeature (#82268) --- homeassistant/components/mqtt/update.py | 2 +- homeassistant/components/update/__init__.py | 4 ++-- pylint/plugins/hass_enforce_type_hints.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mqtt/update.py b/homeassistant/components/mqtt/update.py index abad1cdb2ff..9e08f765be0 100644 --- a/homeassistant/components/mqtt/update.py +++ b/homeassistant/components/mqtt/update.py @@ -253,7 +253,7 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity): get_mqtt_data(self.hass).state_write_requests.write_state_request(self) @property - def supported_features(self) -> int: + def supported_features(self) -> UpdateEntityFeature | int: """Return the list of supported features.""" support = 0 diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index 9ec748c1ed5..92272d56c4b 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -190,7 +190,7 @@ class UpdateEntity(RestoreEntity): _attr_release_summary: str | None = None _attr_release_url: str | None = None _attr_state: None = None - _attr_supported_features: int = 0 + _attr_supported_features: UpdateEntityFeature | int = 0 _attr_title: str | None = None __skipped_version: str | None = None __in_progress: bool = False @@ -270,7 +270,7 @@ class UpdateEntity(RestoreEntity): return self._attr_release_url @property - def supported_features(self) -> int: + def supported_features(self) -> UpdateEntityFeature | int: """Flag supported features.""" return self._attr_supported_features diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index b9247bbca27..ade51cbe97d 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -2345,7 +2345,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ), TypeHintMatch( function_name="supported_features", - return_type="int", + return_type=["UpdateEntityFeature", "int"], ), TypeHintMatch( function_name="title",