Add type annotations to Ambient PWS (#52596)

This commit is contained in:
Aaron Bach 2021-07-06 13:19:58 -05:00 committed by GitHub
parent 2f1af9a254
commit 9fb05736e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 36 deletions

View file

@ -1,10 +1,13 @@
"""Config flow to configure the Ambient PWS component."""
from __future__ import annotations
from aioambient import Client
from aioambient.errors import AmbientError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_API_KEY
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import aiohttp_client
from .const import CONF_APP_KEY, DOMAIN
@ -15,13 +18,13 @@ class AmbientStationFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 2
def __init__(self):
def __init__(self) -> None:
"""Initialize the config flow."""
self.data_schema = vol.Schema(
{vol.Required(CONF_API_KEY): str, vol.Required(CONF_APP_KEY): str}
)
async def _show_form(self, errors=None):
async def _show_form(self, errors: dict | None = None) -> FlowResult:
"""Show the form to the user."""
return self.async_show_form(
step_id="user",
@ -29,7 +32,7 @@ class AmbientStationFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors if errors else {},
)
async def async_step_user(self, user_input=None):
async def async_step_user(self, user_input: dict | None = None) -> FlowResult:
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()