Remove izone from mypy ignore list (#75005)

This commit is contained in:
epenet 2022-07-11 16:53:14 +02:00 committed by GitHub
parent fe1c23321e
commit 73a8ae35c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 17 deletions

View File

@ -76,7 +76,7 @@ async def async_setup_entry(
@callback @callback
def init_controller(ctrl: Controller): def init_controller(ctrl: Controller):
"""Register the controller device and the containing zones.""" """Register the controller device and the containing zones."""
conf: ConfigType = hass.data.get(DATA_CONFIG) conf: ConfigType | None = hass.data.get(DATA_CONFIG)
# Filter out any entities excluded in the config file # Filter out any entities excluded in the config file
if conf and ctrl.device_uid in conf[CONF_EXCLUDE]: if conf and ctrl.device_uid in conf[CONF_EXCLUDE]:
@ -107,8 +107,6 @@ async def async_setup_entry(
"async_set_airflow_max", "async_set_airflow_max",
) )
return True
def _return_on_connection_error(ret=None): def _return_on_connection_error(ret=None):
def wrap(func): def wrap(func):
@ -310,7 +308,7 @@ class ControllerDevice(ClimateEntity):
return key return key
assert False, "Should be unreachable" assert False, "Should be unreachable"
@property @property # type: ignore[misc]
@_return_on_connection_error([]) @_return_on_connection_error([])
def hvac_modes(self) -> list[HVACMode]: def hvac_modes(self) -> list[HVACMode]:
"""Return the list of available operation modes.""" """Return the list of available operation modes."""
@ -318,13 +316,13 @@ class ControllerDevice(ClimateEntity):
return [HVACMode.OFF, HVACMode.FAN_ONLY] return [HVACMode.OFF, HVACMode.FAN_ONLY]
return [HVACMode.OFF, *self._state_to_pizone] return [HVACMode.OFF, *self._state_to_pizone]
@property @property # type: ignore[misc]
@_return_on_connection_error(PRESET_NONE) @_return_on_connection_error(PRESET_NONE)
def preset_mode(self): def preset_mode(self):
"""Eco mode is external air.""" """Eco mode is external air."""
return PRESET_ECO if self._controller.free_air else PRESET_NONE return PRESET_ECO if self._controller.free_air else PRESET_NONE
@property @property # type: ignore[misc]
@_return_on_connection_error([PRESET_NONE]) @_return_on_connection_error([PRESET_NONE])
def preset_modes(self): def preset_modes(self):
"""Available preset modes, normal or eco.""" """Available preset modes, normal or eco."""
@ -332,7 +330,7 @@ class ControllerDevice(ClimateEntity):
return [PRESET_NONE, PRESET_ECO] return [PRESET_NONE, PRESET_ECO]
return [PRESET_NONE] return [PRESET_NONE]
@property @property # type: ignore[misc]
@_return_on_connection_error() @_return_on_connection_error()
def current_temperature(self) -> float | None: def current_temperature(self) -> float | None:
"""Return the current temperature.""" """Return the current temperature."""
@ -362,7 +360,7 @@ class ControllerDevice(ClimateEntity):
return None return None
return zone.target_temperature return zone.target_temperature
@property @property # type: ignore[misc]
@_return_on_connection_error() @_return_on_connection_error()
def target_temperature(self) -> float | None: def target_temperature(self) -> float | None:
"""Return the temperature we try to reach (either from control zone or master unit).""" """Return the temperature we try to reach (either from control zone or master unit)."""
@ -390,13 +388,13 @@ class ControllerDevice(ClimateEntity):
"""Return the list of available fan modes.""" """Return the list of available fan modes."""
return list(self._fan_to_pizone) return list(self._fan_to_pizone)
@property @property # type: ignore[misc]
@_return_on_connection_error(0.0) @_return_on_connection_error(0.0)
def min_temp(self) -> float: def min_temp(self) -> float:
"""Return the minimum temperature.""" """Return the minimum temperature."""
return self._controller.temp_min return self._controller.temp_min
@property @property # type: ignore[misc]
@_return_on_connection_error(50.0) @_return_on_connection_error(50.0)
def max_temp(self) -> float: def max_temp(self) -> float:
"""Return the maximum temperature.""" """Return the maximum temperature."""
@ -471,7 +469,9 @@ class ZoneDevice(ClimateEntity):
self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
identifiers={(IZONE, controller.unique_id, zone.index)}, identifiers={
(IZONE, controller.unique_id, zone.index) # type:ignore[arg-type]
},
manufacturer="IZone", manufacturer="IZone",
model=zone.type.name.title(), model=zone.type.name.title(),
name=self.name, name=self.name,
@ -533,7 +533,7 @@ class ZoneDevice(ClimateEntity):
""" """
return False return False
@property @property # type: ignore[misc]
@_return_on_connection_error(0) @_return_on_connection_error(0)
def supported_features(self): def supported_features(self):
"""Return the list of supported features.""" """Return the list of supported features."""
@ -552,7 +552,7 @@ class ZoneDevice(ClimateEntity):
return PRECISION_TENTHS return PRECISION_TENTHS
@property @property
def hvac_mode(self) -> HVACMode: def hvac_mode(self) -> HVACMode | None:
"""Return current operation ie. heat, cool, idle.""" """Return current operation ie. heat, cool, idle."""
mode = self._zone.mode mode = self._zone.mode
for (key, value) in self._state_to_pizone.items(): for (key, value) in self._state_to_pizone.items():

View File

@ -2687,9 +2687,6 @@ ignore_errors = true
[mypy-homeassistant.components.icloud.sensor] [mypy-homeassistant.components.icloud.sensor]
ignore_errors = true ignore_errors = true
[mypy-homeassistant.components.izone.climate]
ignore_errors = true
[mypy-homeassistant.components.lovelace] [mypy-homeassistant.components.lovelace]
ignore_errors = true ignore_errors = true

View File

@ -30,7 +30,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.icloud.account", "homeassistant.components.icloud.account",
"homeassistant.components.icloud.device_tracker", "homeassistant.components.icloud.device_tracker",
"homeassistant.components.icloud.sensor", "homeassistant.components.icloud.sensor",
"homeassistant.components.izone.climate",
"homeassistant.components.lovelace", "homeassistant.components.lovelace",
"homeassistant.components.lovelace.dashboard", "homeassistant.components.lovelace.dashboard",
"homeassistant.components.lovelace.resources", "homeassistant.components.lovelace.resources",