mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add Withings to strict-typing (#101761)
* Add Withings to strict-typing * Rebase
This commit is contained in:
parent
8c14824bd5
commit
1a348babd4
@ -361,6 +361,7 @@ homeassistant.components.webostv.*
|
||||
homeassistant.components.websocket_api.*
|
||||
homeassistant.components.wemo.*
|
||||
homeassistant.components.whois.*
|
||||
homeassistant.components.withings.*
|
||||
homeassistant.components.wiz.*
|
||||
homeassistant.components.wled.*
|
||||
homeassistant.components.worldclock.*
|
||||
|
@ -8,7 +8,7 @@ import asyncio
|
||||
from collections.abc import Awaitable, Callable
|
||||
import contextlib
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from aiohttp.hdrs import METH_POST
|
||||
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:
|
||||
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
|
||||
coordinators: dict[str, WithingsDataUpdateCoordinator] = {
|
||||
|
10
mypy.ini
10
mypy.ini
@ -3373,6 +3373,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = 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.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user