Update typing 09 (#48059)

This commit is contained in:
Marc Mueller 2021-03-18 10:02:00 +01:00 committed by GitHub
parent 2ab640aaef
commit 283b4abe67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 239 additions and 196 deletions

View file

@ -1,5 +1,5 @@
"""Support for Insteon thermostat."""
from typing import List, Optional
from __future__ import annotations
from pyinsteon.constants import ThermostatMode
from pyinsteon.operating_flag import CELSIUS
@ -97,7 +97,7 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
return TEMP_FAHRENHEIT
@property
def current_humidity(self) -> Optional[int]:
def current_humidity(self) -> int | None:
"""Return the current humidity."""
return self._insteon_device.groups[HUMIDITY].value
@ -107,17 +107,17 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
return HVAC_MODES[self._insteon_device.groups[SYSTEM_MODE].value]
@property
def hvac_modes(self) -> List[str]:
def hvac_modes(self) -> list[str]:
"""Return the list of available hvac operation modes."""
return list(HVAC_MODES.values())
@property
def current_temperature(self) -> Optional[float]:
def current_temperature(self) -> float | None:
"""Return the current temperature."""
return self._insteon_device.groups[TEMPERATURE].value
@property
def target_temperature(self) -> Optional[float]:
def target_temperature(self) -> float | None:
"""Return the temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.HEAT:
return self._insteon_device.groups[HEAT_SET_POINT].value
@ -126,31 +126,31 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
return None
@property
def target_temperature_high(self) -> Optional[float]:
def target_temperature_high(self) -> float | None:
"""Return the highbound target temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.AUTO:
return self._insteon_device.groups[COOL_SET_POINT].value
return None
@property
def target_temperature_low(self) -> Optional[float]:
def target_temperature_low(self) -> float | None:
"""Return the lowbound target temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.AUTO:
return self._insteon_device.groups[HEAT_SET_POINT].value
return None
@property
def fan_mode(self) -> Optional[str]:
def fan_mode(self) -> str | None:
"""Return the fan setting."""
return FAN_MODES[self._insteon_device.groups[FAN_MODE].value]
@property
def fan_modes(self) -> Optional[List[str]]:
def fan_modes(self) -> list[str] | None:
"""Return the list of available fan modes."""
return list(FAN_MODES.values())
@property
def target_humidity(self) -> Optional[int]:
def target_humidity(self) -> int | None:
"""Return the humidity we try to reach."""
high = self._insteon_device.groups[HUMIDITY_HIGH].value
low = self._insteon_device.groups[HUMIDITY_LOW].value
@ -163,7 +163,7 @@ class InsteonClimateEntity(InsteonEntity, ClimateEntity):
return 1
@property
def hvac_action(self) -> Optional[str]:
def hvac_action(self) -> str | None:
"""Return the current running hvac operation if supported.
Need to be one of CURRENT_HVAC_*.