Remove str as a valid HVACMode & HVACAction type (#94644)

* Remove str as a valid HAVCMode type

* Adjust pylint plugin

* Also remove str from hvac_action property method
This commit is contained in:
Franck Nijhof 2023-06-15 20:16:17 +02:00 committed by GitHub
parent 324bd9a97a
commit 21bdcd6b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -214,9 +214,9 @@ class ClimateEntity(Entity):
_attr_current_temperature: float | None = None _attr_current_temperature: float | None = None
_attr_fan_mode: str | None _attr_fan_mode: str | None
_attr_fan_modes: list[str] | None _attr_fan_modes: list[str] | None
_attr_hvac_action: HVACAction | str | None = None _attr_hvac_action: HVACAction | None = None
_attr_hvac_mode: HVACMode | str | None _attr_hvac_mode: HVACMode | None
_attr_hvac_modes: list[HVACMode] | list[str] _attr_hvac_modes: list[HVACMode]
_attr_is_aux_heat: bool | None _attr_is_aux_heat: bool | None
_attr_max_humidity: int = DEFAULT_MAX_HUMIDITY _attr_max_humidity: int = DEFAULT_MAX_HUMIDITY
_attr_max_temp: float _attr_max_temp: float
@ -361,17 +361,17 @@ class ClimateEntity(Entity):
return self._attr_target_humidity return self._attr_target_humidity
@property @property
def hvac_mode(self) -> HVACMode | str | None: def hvac_mode(self) -> HVACMode | None:
"""Return hvac operation ie. heat, cool mode.""" """Return hvac operation ie. heat, cool mode."""
return self._attr_hvac_mode return self._attr_hvac_mode
@property @property
def hvac_modes(self) -> list[HVACMode] | list[str]: def hvac_modes(self) -> list[HVACMode]:
"""Return the list of available hvac operation modes.""" """Return the list of available hvac operation modes."""
return self._attr_hvac_modes return self._attr_hvac_modes
@property @property
def hvac_action(self) -> HVACAction | str | None: def hvac_action(self) -> HVACAction | None:
"""Return the current running hvac operation if supported.""" """Return the current running hvac operation if supported."""
return self._attr_hvac_action return self._attr_hvac_action

View File

@ -1023,15 +1023,15 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
), ),
TypeHintMatch( TypeHintMatch(
function_name="hvac_mode", function_name="hvac_mode",
return_type=["HVACMode", "str", None], return_type=["HVACMode", None],
), ),
TypeHintMatch( TypeHintMatch(
function_name="hvac_modes", function_name="hvac_modes",
return_type=["list[HVACMode]", "list[str]"], return_type="list[HVACMode]",
), ),
TypeHintMatch( TypeHintMatch(
function_name="hvac_action", function_name="hvac_action",
return_type=["HVACAction", "str", None], return_type=["HVACAction", None],
), ),
TypeHintMatch( TypeHintMatch(
function_name="current_temperature", function_name="current_temperature",