Remove withings from mypy ignore list (#74966)

This commit is contained in:
epenet 2022-07-11 19:14:23 +02:00 committed by GitHub
parent 7c2bd319f1
commit 28a34a1f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 23 deletions

View File

@ -6,6 +6,7 @@ For more details about this platform, please refer to the documentation at
from __future__ import annotations
import asyncio
from typing import Any
from aiohttp.web import Request, Response
import voluptuous as vol
@ -103,7 +104,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Withings from a config entry."""
config_updates = {}
config_updates: dict[str, Any] = {}
# Add a unique id if it's an older config entry.
if entry.unique_id != entry.data["token"]["userid"] or not isinstance(
@ -197,7 +198,7 @@ async def async_webhook_handler(
return json_message_response("Parameter appli not provided", message_code=20)
try:
appli = NotifyAppli(int(params.getone("appli")))
appli = NotifyAppli(int(params.getone("appli"))) # type: ignore[arg-type]
except ValueError:
return json_message_response("Invalid appli provided", message_code=21)

View File

@ -32,6 +32,6 @@ class WithingsHealthBinarySensor(BaseWithingsSensor, BinarySensorEntity):
_attr_device_class = BinarySensorDeviceClass.OCCUPANCY
@property
def is_on(self) -> bool:
def is_on(self) -> bool | None:
"""Return true if the binary sensor is on."""
return self._state_data

View File

@ -10,7 +10,7 @@ from enum import Enum, IntEnum
from http import HTTPStatus
import logging
import re
from typing import Any
from typing import Any, Union
from aiohttp.web import Response
import requests
@ -589,7 +589,7 @@ class DataManager:
update_method=self.async_subscribe_webhook,
)
self.poll_data_update_coordinator = DataUpdateCoordinator[
dict[MeasureType, Any]
Union[dict[MeasureType, Any], None]
](
hass,
_LOGGER,
@ -951,7 +951,7 @@ class BaseWithingsSensor(Entity):
return self._unique_id
@property
def icon(self) -> str:
def icon(self) -> str | None:
"""Icon to use in the frontend, if any."""
return self._attribute.icon
@ -1005,7 +1005,7 @@ async def async_get_data_manager(
config_entry_data = hass.data[const.DOMAIN][config_entry.entry_id]
if const.DATA_MANAGER not in config_entry_data:
profile = config_entry.data.get(const.PROFILE)
profile: str = config_entry.data[const.PROFILE]
_LOGGER.debug("Creating withings data manager for profile: %s", profile)
config_entry_data[const.DATA_MANAGER] = DataManager(

View File

@ -2760,15 +2760,3 @@ ignore_errors = true
[mypy-homeassistant.components.template.sensor]
ignore_errors = true
[mypy-homeassistant.components.withings]
ignore_errors = true
[mypy-homeassistant.components.withings.binary_sensor]
ignore_errors = true
[mypy-homeassistant.components.withings.common]
ignore_errors = true
[mypy-homeassistant.components.withings.config_flow]
ignore_errors = true

View File

@ -51,10 +51,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.sonos.statistics",
"homeassistant.components.template.number",
"homeassistant.components.template.sensor",
"homeassistant.components.withings",
"homeassistant.components.withings.binary_sensor",
"homeassistant.components.withings.common",
"homeassistant.components.withings.config_flow",
]
# Component modules which should set no_implicit_reexport = true.