Ensure Ambient PWS is strictly typed (#53251)

* Ensure Ambient PWS is strictly typed

* Fix typing
pull/53242/head
Aaron Bach 2021-07-20 20:52:05 -06:00 committed by GitHub
parent 9d3bc0632f
commit 56efee4603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -13,6 +13,7 @@ homeassistant.components.aladdin_connect.*
homeassistant.components.alarm_control_panel.*
homeassistant.components.amazon_polly.*
homeassistant.components.ambee.*
homeassistant.components.ambient_station.*
homeassistant.components.ampio.*
homeassistant.components.automation.*
homeassistant.components.binary_sensor.*

View File

@ -32,7 +32,7 @@ from homeassistant.const import (
SPEED_MILES_PER_HOUR,
TEMP_FAHRENHEIT,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import aiohttp_client, config_validation as cv
from homeassistant.helpers.dispatcher import (
@ -320,7 +320,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
LOGGER.error("Config entry failed: %s", err)
raise ConfigEntryNotReady from err
async def _async_disconnect_websocket(*_):
async def _async_disconnect_websocket(_: Event) -> None:
await ambient.client.websocket.disconnect()
config_entry.async_on_unload(
@ -378,7 +378,7 @@ class AmbientStation:
async def _attempt_connect(self) -> None:
"""Attempt to connect to the socket (retrying later on fail)."""
async def connect(timestamp: int | None = None):
async def connect(timestamp: int | None = None) -> None:
"""Connect."""
await self.client.websocket.connect()

View File

@ -154,6 +154,17 @@ no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.ambient_station.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.ampio.*]
check_untyped_defs = true
disallow_incomplete_defs = true