mirror of https://github.com/home-assistant/core
Enable strict typing for ambiclimate (#106819)
This commit is contained in:
parent
cc18b9a2d8
commit
d93d25a7d1
|
@ -63,6 +63,7 @@ homeassistant.components.alexa.*
|
|||
homeassistant.components.alpha_vantage.*
|
||||
homeassistant.components.amazon_polly.*
|
||||
homeassistant.components.amberelectric.*
|
||||
homeassistant.components.ambiclimate.*
|
||||
homeassistant.components.ambient_station.*
|
||||
homeassistant.components.amcrest.*
|
||||
homeassistant.components.ampio.*
|
||||
|
|
|
@ -6,6 +6,7 @@ import logging
|
|||
from typing import Any
|
||||
|
||||
import ambiclimate
|
||||
from ambiclimate import AmbiclimateDevice
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
|
@ -157,13 +158,13 @@ class AmbiclimateEntity(ClimateEntity):
|
|||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, heater, store):
|
||||
def __init__(self, heater: AmbiclimateDevice, store: Store[dict[str, Any]]) -> None:
|
||||
"""Initialize the thermostat."""
|
||||
self._heater = heater
|
||||
self._store = store
|
||||
self._attr_unique_id = heater.device_id
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self.unique_id)},
|
||||
identifiers={(DOMAIN, self.unique_id)}, # type: ignore[arg-type]
|
||||
manufacturer="Ambiclimate",
|
||||
name=heater.name,
|
||||
)
|
||||
|
|
|
@ -114,7 +114,7 @@ class AmbiclimateFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
store = Store[dict[str, Any]](self.hass, STORAGE_VERSION, STORAGE_KEY)
|
||||
await store.async_save(token_info)
|
||||
|
||||
return token_info
|
||||
return token_info # type: ignore[no-any-return]
|
||||
|
||||
def _generate_view(self) -> None:
|
||||
self.hass.http.register_view(AmbiclimateAuthCallbackView())
|
||||
|
@ -132,12 +132,12 @@ class AmbiclimateFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
clientsession,
|
||||
)
|
||||
|
||||
def _cb_url(self):
|
||||
def _cb_url(self) -> str:
|
||||
return f"{get_url(self.hass, prefer_external=True)}{AUTH_CALLBACK_PATH}"
|
||||
|
||||
async def _get_authorize_url(self):
|
||||
async def _get_authorize_url(self) -> str:
|
||||
oauth = self._generate_oauth()
|
||||
return oauth.get_authorize_url()
|
||||
return oauth.get_authorize_url() # type: ignore[no-any-return]
|
||||
|
||||
|
||||
class AmbiclimateAuthCallbackView(HomeAssistantView):
|
||||
|
|
10
mypy.ini
10
mypy.ini
|
@ -390,6 +390,16 @@ disallow_untyped_defs = true
|
|||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.ambiclimate.*]
|
||||
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.ambient_station.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
|
Loading…
Reference in New Issue