Add Withings to strict-typing (#101761)

* Add Withings to strict-typing

* Rebase
This commit is contained in:
Joost Lekkerkerker 2023-10-15 19:08:57 +02:00 committed by GitHub
parent 8c14824bd5
commit 1a348babd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -361,6 +361,7 @@ homeassistant.components.webostv.*
homeassistant.components.websocket_api.* homeassistant.components.websocket_api.*
homeassistant.components.wemo.* homeassistant.components.wemo.*
homeassistant.components.whois.* homeassistant.components.whois.*
homeassistant.components.withings.*
homeassistant.components.wiz.* homeassistant.components.wiz.*
homeassistant.components.wled.* homeassistant.components.wled.*
homeassistant.components.worldclock.* homeassistant.components.worldclock.*

View File

@ -8,7 +8,7 @@ import asyncio
from collections.abc import Awaitable, Callable from collections.abc import Awaitable, Callable
import contextlib import contextlib
from datetime import timedelta from datetime import timedelta
from typing import Any from typing import TYPE_CHECKING, Any
from aiohttp.hdrs import METH_POST from aiohttp.hdrs import METH_POST
from aiohttp.web import Request, Response from aiohttp.web import Request, Response
@ -148,7 +148,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def _refresh_token() -> str: async def _refresh_token() -> str:
await oauth_session.async_ensure_token_valid() await oauth_session.async_ensure_token_valid()
return oauth_session.token[CONF_ACCESS_TOKEN] token = oauth_session.token[CONF_ACCESS_TOKEN]
if TYPE_CHECKING:
assert isinstance(token, str)
return token
client.refresh_token_function = _refresh_token client.refresh_token_function = _refresh_token
coordinators: dict[str, WithingsDataUpdateCoordinator] = { coordinators: dict[str, WithingsDataUpdateCoordinator] = {

View File

@ -3373,6 +3373,16 @@ disallow_untyped_defs = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
[mypy-homeassistant.components.withings.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.wiz.*] [mypy-homeassistant.components.wiz.*]
check_untyped_defs = true check_untyped_defs = true
disallow_incomplete_defs = true disallow_incomplete_defs = true