Improve lists in integrations [A] (#113006)

* Use list comprehension [A]

* Use list comprehension [A]

* Update homeassistant/components/aws/notify.py
This commit is contained in:
Joost Lekkerkerker 2024-03-11 16:17:44 +01:00 committed by GitHub
parent bf40b33117
commit 690ba103ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 267 additions and 297 deletions

View file

@ -1196,11 +1196,12 @@ class AlexaThermostatController(AlexaCapability):
if self.entity.domain == water_heater.DOMAIN:
return None
supported_modes: list[str] = []
hvac_modes = self.entity.attributes.get(climate.ATTR_HVAC_MODES) or []
for mode in hvac_modes:
if thermostat_mode := API_THERMOSTAT_MODES.get(mode):
supported_modes.append(thermostat_mode)
supported_modes: list[str] = [
API_THERMOSTAT_MODES[mode]
for mode in hvac_modes
if mode in API_THERMOSTAT_MODES
]
preset_modes = self.entity.attributes.get(climate.ATTR_PRESET_MODES)
if preset_modes: