Remove withings from mypy ignore list (#74966)
This commit is contained in:
parent
7c2bd319f1
commit
28a34a1f89
5 changed files with 8 additions and 23 deletions
|
@ -6,6 +6,7 @@ For more details about this platform, please refer to the documentation at
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp.web import Request, Response
|
from aiohttp.web import Request, Response
|
||||||
import voluptuous as vol
|
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:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Withings from a config entry."""
|
"""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.
|
# Add a unique id if it's an older config entry.
|
||||||
if entry.unique_id != entry.data["token"]["userid"] or not isinstance(
|
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)
|
return json_message_response("Parameter appli not provided", message_code=20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
appli = NotifyAppli(int(params.getone("appli")))
|
appli = NotifyAppli(int(params.getone("appli"))) # type: ignore[arg-type]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return json_message_response("Invalid appli provided", message_code=21)
|
return json_message_response("Invalid appli provided", message_code=21)
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,6 @@ class WithingsHealthBinarySensor(BaseWithingsSensor, BinarySensorEntity):
|
||||||
_attr_device_class = BinarySensorDeviceClass.OCCUPANCY
|
_attr_device_class = BinarySensorDeviceClass.OCCUPANCY
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool | None:
|
||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
return self._state_data
|
return self._state_data
|
||||||
|
|
|
@ -10,7 +10,7 @@ from enum import Enum, IntEnum
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any, Union
|
||||||
|
|
||||||
from aiohttp.web import Response
|
from aiohttp.web import Response
|
||||||
import requests
|
import requests
|
||||||
|
@ -589,7 +589,7 @@ class DataManager:
|
||||||
update_method=self.async_subscribe_webhook,
|
update_method=self.async_subscribe_webhook,
|
||||||
)
|
)
|
||||||
self.poll_data_update_coordinator = DataUpdateCoordinator[
|
self.poll_data_update_coordinator = DataUpdateCoordinator[
|
||||||
dict[MeasureType, Any]
|
Union[dict[MeasureType, Any], None]
|
||||||
](
|
](
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
@ -951,7 +951,7 @@ class BaseWithingsSensor(Entity):
|
||||||
return self._unique_id
|
return self._unique_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str:
|
def icon(self) -> str | None:
|
||||||
"""Icon to use in the frontend, if any."""
|
"""Icon to use in the frontend, if any."""
|
||||||
return self._attribute.icon
|
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]
|
config_entry_data = hass.data[const.DOMAIN][config_entry.entry_id]
|
||||||
|
|
||||||
if const.DATA_MANAGER not in config_entry_data:
|
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)
|
_LOGGER.debug("Creating withings data manager for profile: %s", profile)
|
||||||
config_entry_data[const.DATA_MANAGER] = DataManager(
|
config_entry_data[const.DATA_MANAGER] = DataManager(
|
||||||
|
|
12
mypy.ini
12
mypy.ini
|
@ -2760,15 +2760,3 @@ ignore_errors = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.template.sensor]
|
[mypy-homeassistant.components.template.sensor]
|
||||||
ignore_errors = true
|
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
|
|
||||||
|
|
|
@ -51,10 +51,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||||
"homeassistant.components.sonos.statistics",
|
"homeassistant.components.sonos.statistics",
|
||||||
"homeassistant.components.template.number",
|
"homeassistant.components.template.number",
|
||||||
"homeassistant.components.template.sensor",
|
"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.
|
# Component modules which should set no_implicit_reexport = true.
|
||||||
|
|
Loading…
Add table
Reference in a new issue