From 8cdadd155261cdbdcb639bfd5846296b95d92473 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 6 Dec 2022 14:50:44 +0100 Subject: [PATCH] Remove str from switch device class (#83400) --- homeassistant/components/switch/__init__.py | 6 +++--- pylint/plugins/hass_enforce_type_hints.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 7387685187a..6eb2a275e18 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -93,17 +93,17 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class SwitchEntityDescription(ToggleEntityDescription): """A class that describes switch entities.""" - device_class: SwitchDeviceClass | str | None = None + device_class: SwitchDeviceClass | None = None class SwitchEntity(ToggleEntity): """Base class for switch entities.""" entity_description: SwitchEntityDescription - _attr_device_class: SwitchDeviceClass | str | None + _attr_device_class: SwitchDeviceClass | None @property - def device_class(self) -> SwitchDeviceClass | str | None: + def device_class(self) -> SwitchDeviceClass | None: """Return the class of this entity.""" if hasattr(self, "_attr_device_class"): return self._attr_device_class diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 1908a85ed9b..4f7b9053ca0 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -2269,7 +2269,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { matches=[ TypeHintMatch( function_name="device_class", - return_type=["SwitchDeviceClass", "str", None], + return_type=["SwitchDeviceClass", None], ), ], ),