From ab26ea06b90010485d88c442940e468d47133377 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 22 Nov 2022 07:16:53 +0100 Subject: [PATCH] Enforce UpdateEntityFeature (#82465) --- homeassistant/components/mqtt/update.py | 4 ++-- homeassistant/components/update/__init__.py | 4 ++-- pylint/plugins/hass_enforce_type_hints.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/mqtt/update.py b/homeassistant/components/mqtt/update.py index 9e08f765be0..0875778059f 100644 --- a/homeassistant/components/mqtt/update.py +++ b/homeassistant/components/mqtt/update.py @@ -253,9 +253,9 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity): get_mqtt_data(self.hass).state_write_requests.write_state_request(self) @property - def supported_features(self) -> UpdateEntityFeature | int: + def supported_features(self) -> UpdateEntityFeature: """Return the list of supported features.""" - support = 0 + support = UpdateEntityFeature(0) if self._config.get(CONF_COMMAND_TOPIC) is not None: support |= UpdateEntityFeature.INSTALL diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index 92272d56c4b..57e20a764ba 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: UpdateEntityFeature | int = 0 + _attr_supported_features: UpdateEntityFeature = UpdateEntityFeature(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) -> UpdateEntityFeature | int: + def supported_features(self) -> UpdateEntityFeature: """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 ac8c6e674e0..53c3aa4b8b3 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=["UpdateEntityFeature", "int"], + return_type="UpdateEntityFeature", ), TypeHintMatch( function_name="title",