Remove lyric from mypy ignore list (#74451)

This commit is contained in:
epenet 2022-07-05 20:24:18 +02:00 committed by GitHub
parent 89ab78371f
commit cbe9eda0a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 19 deletions

View file

@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio
import logging
from time import localtime, strftime, time
from typing import Any
from aiolyric.objects.device import LyricDevice
from aiolyric.objects.location import LyricLocation
@ -186,7 +187,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
return self.device.indoorTemperature
@property
def hvac_action(self) -> HVACAction:
def hvac_action(self) -> HVACAction | None:
"""Return the current hvac action."""
action = HVAC_ACTIONS.get(self.device.operationStatus.mode, None)
if action == HVACAction.OFF and self.hvac_mode != HVACMode.OFF:
@ -265,7 +266,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
return device.maxHeatSetpoint
return device.maxCoolSetpoint
async def async_set_temperature(self, **kwargs) -> None:
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature."""
if self.hvac_mode == HVACMode.OFF:
return

View file

@ -1,4 +1,6 @@
"""Config flow for Honeywell Lyric."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
@ -25,13 +27,15 @@ class OAuth2FlowHandler(
"""Perform reauth upon an API authentication error."""
return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm(self, user_input=None):
async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Dialog that informs the user that reauth is required."""
if user_input is None:
return self.async_show_form(step_id="reauth_confirm")
return await self.async_step_user()
async def async_oauth_create_entry(self, data: dict) -> dict:
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult:
"""Create an oauth config entry or update existing entry for reauth."""
existing_entry = await self.async_set_unique_id(DOMAIN)
if existing_entry:

View file

@ -47,9 +47,11 @@ class LyricSensorEntityDescription(SensorEntityDescription):
value: Callable[[LyricDevice], StateType | datetime] = round
def get_datetime_from_future_time(time: str) -> datetime:
def get_datetime_from_future_time(time_str: str) -> datetime:
"""Get datetime from future time provided."""
time = dt_util.parse_time(time)
time = dt_util.parse_time(time_str)
if time is None:
raise ValueError(f"Unable to parse time {time_str}")
now = dt_util.utcnow()
if time <= now.time():
now = now + timedelta(days=1)
@ -64,7 +66,7 @@ async def async_setup_entry(
entities = []
def get_setpoint_status(status: str, time: str) -> str:
def get_setpoint_status(status: str, time: str) -> str | None:
if status == PRESET_HOLD_UNTIL:
return f"Held until {time}"
return LYRIC_SETPOINT_STATUS_NAMES.get(status, None)

View file

@ -2752,15 +2752,6 @@ ignore_errors = true
[mypy-homeassistant.components.lovelace.websocket]
ignore_errors = true
[mypy-homeassistant.components.lyric.climate]
ignore_errors = true
[mypy-homeassistant.components.lyric.config_flow]
ignore_errors = true
[mypy-homeassistant.components.lyric.sensor]
ignore_errors = true
[mypy-homeassistant.components.meteo_france.sensor]
ignore_errors = true

View file

@ -59,9 +59,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.lovelace.dashboard",
"homeassistant.components.lovelace.resources",
"homeassistant.components.lovelace.websocket",
"homeassistant.components.lyric.climate",
"homeassistant.components.lyric.config_flow",
"homeassistant.components.lyric.sensor",
"homeassistant.components.meteo_france.sensor",
"homeassistant.components.meteo_france.weather",
"homeassistant.components.minecraft_server",