Improve config flow type hints (part 1) (#124343)

* Improve config flow type hints

* Revert sms
This commit is contained in:
epenet 2024-08-21 22:42:58 +02:00 committed by GitHub
parent 67bc568db6
commit 913e5404da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 348 additions and 114 deletions

View file

@ -1,9 +1,11 @@
"""Config flow for AirTouch4."""
from typing import Any
from airtouch4pyapi import AirTouch, AirTouchStatus
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST
from .const import DOMAIN
@ -16,7 +18,9 @@ class AirtouchConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
if user_input is None:
return self.async_show_form(step_id="user", data_schema=DATA_SCHEMA)

View file

@ -2,6 +2,8 @@
from __future__ import annotations
from typing import Any
from aioambient import API
from aioambient.errors import AmbientError
import voluptuous as vol
@ -32,7 +34,9 @@ class AmbientStationFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors if errors else {},
)
async def async_step_user(self, user_input: dict | None = None) -> ConfigFlowResult:
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from aiohttp.client_exceptions import ClientError
from pyControl4.account import C4Account
@ -10,7 +11,12 @@ from pyControl4.director import C4Director
from pyControl4.error_handling import NotFound, Unauthorized
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
@ -93,7 +99,9 @@ class Control4ConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -2,10 +2,17 @@
from __future__ import annotations
from typing import Any
from pydexcom import AccountError, Dexcom, SessionError
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PASSWORD, CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
from homeassistant.core import callback
@ -25,7 +32,9 @@ class DexcomConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,10 +1,12 @@
"""Config flow to configure the EcoNet component."""
from typing import Any
from pyeconet import EcoNetApiInterface
from pyeconet.errors import InvalidCredentialsError, PyeconetError
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from .const import DOMAIN
@ -24,7 +26,9 @@ class EcoNetFlowHandler(ConfigFlow, domain=DOMAIN):
}
)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow."""
if not user_input:
return self.async_show_form(

View file

@ -1,8 +1,10 @@
"""Config flow to configure emulated_roku component."""
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
@ -22,9 +24,11 @@ class EmulatedRokuFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
errors = {}
errors: dict[str, str] = {}
if user_input is not None:
self._async_abort_entries_match({CONF_NAME: user_input[CONF_NAME]})

View file

@ -1,8 +1,10 @@
"""Config flows for the ENOcean integration."""
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_DEVICE
from . import dongle
@ -32,7 +34,9 @@ class EnOceanFlowHandler(ConfigFlow, domain=DOMAIN):
return self.create_enocean_entry(data)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle an EnOcean config flow start."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")

View file

@ -1,13 +1,14 @@
"""Config flow for Environment Canada integration."""
import logging
from typing import Any
import xml.etree.ElementTree as ET
import aiohttp
from env_canada import ECWeather, ec_exc
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_LANGUAGE, CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.helpers import config_validation as cv
@ -46,7 +47,9 @@ class EnvironmentCanadaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,10 +1,11 @@
"""Config flow for epson integration."""
import logging
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
from . import validate_projector
@ -26,7 +27,9 @@ class EpsonConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -2,12 +2,13 @@
import asyncio
import logging
from typing import Any
from pyflick.authentication import AuthException, SimpleFlickAuth
from pyflick.const import DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import (
CONF_CLIENT_ID,
CONF_CLIENT_SECRET,
@ -55,7 +56,9 @@ class FlickConfigFlow(ConfigFlow, domain=DOMAIN):
return token is not None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle gathering login info."""
errors = {}
if user_input is not None:

View file

@ -1,10 +1,12 @@
"""Config flow for flo integration."""
from typing import Any
from aioflo import async_get_api
from aioflo.errors import RequestError
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -36,7 +38,9 @@ class FloConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -2,6 +2,7 @@
from contextlib import suppress
import logging
from typing import Any
from pyforked_daapd import ForkedDaapdAPI
import voluptuous as vol
@ -135,7 +136,9 @@ class ForkedDaapdFlowHandler(ConfigFlow, domain=DOMAIN):
)
return validate_result
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a forked-daapd config flow start.
Manage device specific parameters.

View file

@ -1,5 +1,7 @@
"""Config flow for foscam integration."""
from typing import Any
from libpyfoscam import FoscamCamera
from libpyfoscam.foscam import (
ERROR_FOSCAM_AUTH,
@ -8,7 +10,7 @@ from libpyfoscam.foscam import (
)
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
@ -90,7 +92,9 @@ class FoscamConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=name, data=data)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -1,9 +1,11 @@
"""Config flow to configure Freedompro."""
from typing import Any
from pyfreedompro import get_list
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_KEY
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -45,7 +47,9 @@ class FreedomProConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Show the setup form to the user."""
if user_input is None:
return self.async_show_form(

View file

@ -1,10 +1,11 @@
"""Config flow to configure the GeoNet NZ Quakes integration."""
import logging
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
@ -48,7 +49,9 @@ class GeonetnzQuakesFlowHandler(ConfigFlow, domain=DOMAIN):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow."""
_LOGGER.debug("User input: %s", user_input)
if not user_input:

View file

@ -1,8 +1,10 @@
"""Config flow to configure the GeoNet NZ Volcano integration."""
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
@ -49,7 +51,9 @@ class GeonetnzVolcanoFlowHandler(ConfigFlow, domain=DOMAIN):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow."""
if not user_input:
return await self._show_form()

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from goodwe import InverterError, connect
import voluptuous as vol
@ -26,7 +27,9 @@ class GoodweFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input: dict | None = None) -> ConfigFlowResult:
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
errors = {}
if user_input is not None:

View file

@ -3,12 +3,13 @@
from __future__ import annotations
import logging
from typing import Any
from aiohttp import ClientResponseError
from habitipy.aio import HabitipyAsync
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_URL
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -56,7 +57,9 @@ class HabiticaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -1,6 +1,6 @@
"""Config flow to configure Heos."""
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse
from pyheos import Heos, HeosError
@ -51,7 +51,9 @@ class HeosFlowHandler(ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(DOMAIN, raise_on_progress=False)
return self.async_create_entry(title=format_title(host), data={CONF_HOST: host})
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Obtain host and validate connection."""
self.hass.data.setdefault(DATA_DISCOVERED_HOSTS, {})
# Only a single entry is needed for all devices

View file

@ -1,11 +1,12 @@
"""Config flow for HLK-SW16."""
import asyncio
from typing import Any
from hlk_sw16 import create_hlk_sw16_connection
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant
@ -73,7 +74,9 @@ class SW16FlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle import."""
return await self.async_step_user(user_input)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,11 +1,12 @@
"""Config flow for EnergyFlip integration."""
import logging
from typing import Any
from energyflip import EnergyFlip, EnergyFlipConnectionException, EnergyFlipException
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
from homeassistant.data_entry_flow import AbortFlow
@ -23,7 +24,9 @@ class EnergyFlipConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
if user_input is None:
return await self._show_setup_form(user_input)

View file

@ -1,11 +1,12 @@
"""Config flow for Antifurto365 iAlarm integration."""
import logging
from typing import Any
from pyialarm import IAlarm
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant
@ -31,7 +32,9 @@ class IAlarmConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
mac = None

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from pyinsteon import async_connect
@ -54,7 +55,9 @@ class InsteonFlowHandler(ConfigFlow, domain=DOMAIN):
_device_name: str | None = None
discovered_conf: dict[str, str] = {}
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Init the config flow."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")

View file

@ -1,13 +1,14 @@
"""Config flow for JuiceNet integration."""
import logging
from typing import Any
import aiohttp
from pyjuicenet import Api, TokenError
import voluptuous as vol
from homeassistant import core, exceptions
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -44,7 +45,9 @@ class JuiceNetConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -42,9 +42,9 @@ class MicroBotConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
def __init__(self):
def __init__(self) -> None:
"""Initialize."""
self._errors = {}
self._errors: dict[str, str] = {}
self._discovered_adv: MicroBotAdvertisement | None = None
self._discovered_advs: dict[str, MicroBotAdvertisement] = {}
self._client: MicroBotApiClient | None = None

View file

@ -3,13 +3,19 @@
from __future__ import annotations
import logging
from typing import Any
import aiohttp
from pykmtronic.auth import Auth
from pykmtronic.hub import KMTronicHubAPI
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
@ -62,7 +68,9 @@ class KmtronicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler."""
return KMTronicOptionsFlow(config_entry)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
import voluptuous as vol
@ -149,7 +150,9 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN):
return self._create_entry()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -303,7 +303,9 @@ class KonnectedFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="unknown")
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Connect to panel and get config."""
errors = {}
if user_input:

View file

@ -1,12 +1,13 @@
"""Config flow to configure the Meteoclimatic integration."""
import logging
from typing import Any
from meteoclimatic import MeteoclimaticClient
from meteoclimatic.exceptions import MeteoclimaticError, StationNotFound
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from .const import CONF_STATION_CODE, DOMAIN
@ -35,9 +36,11 @@ class MeteoclimaticFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors or {},
)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
errors = {}
errors: dict[str, str] = {}
if user_input is None:
return self._show_setup_form(user_input, errors)

View file

@ -1,10 +1,12 @@
"""Adds config flow for Mill integration."""
from typing import Any
from mill import Mill
from mill_local import Mill as MillLocal
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -16,7 +18,9 @@ class MillConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
data_schema = vol.Schema(
{

View file

@ -1,9 +1,10 @@
"""Config flow for Mobile App."""
from typing import Any
import uuid
from homeassistant.components import person
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.helpers import entity_registry as er
@ -15,7 +16,9 @@ class MobileAppFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
placeholders = {
"apps_url": "https://www.home-assistant.io/integrations/mobile_app/#apps"

View file

@ -3,12 +3,18 @@
from __future__ import annotations
import logging
from typing import Any
from pymonoprice import get_monoprice
from serial import SerialException
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
@ -76,7 +82,9 @@ class MonoPriceConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -3,7 +3,7 @@
from __future__ import annotations
import logging
from typing import cast
from typing import Any, cast
from urllib.parse import urlparse
from pynetgear import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_USER
@ -175,7 +175,9 @@ class NetgearFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.async_step_user()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
errors = {}

View file

@ -1,13 +1,14 @@
"""Config flow for Nexia integration."""
import logging
from typing import Any
import aiohttp
from nexia.const import BRAND_ASAIR, BRAND_NEXIA, BRAND_TRANE
from nexia.home import NexiaHome
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -81,7 +82,9 @@ class NexiaConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -79,7 +79,7 @@ class NextBusFlowHandler(ConfigFlow, domain=DOMAIN):
_route_tags: dict[str, str]
_stop_tags: dict[str, str]
def __init__(self):
def __init__(self) -> None:
"""Initialize NextBus config flow."""
self.data: dict[str, str] = {}
self._client = NextBusClient()

View file

@ -2,12 +2,13 @@
from http import HTTPStatus
import logging
from typing import Any
import nuheat
import requests.exceptions
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -64,7 +65,9 @@ class NuHeatConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -63,7 +63,9 @@ class OctoPrintConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for OctoPrint."""
self._sessions: list[aiohttp.ClientSession] = []
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
# When coming back from the progress steps, the user_input is stored in the
# instance variable instead of being passed in

View file

@ -3,11 +3,17 @@
from __future__ import annotations
import logging
from typing import Any
from omnilogic import LoginException, OmniLogic, OmniLogicException
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client
@ -30,9 +36,11 @@ class OmniLogicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler."""
return OptionsFlowHandler(config_entry)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
errors: dict[str, str] = {}
config_entry = self._async_current_entries()
if config_entry:

View file

@ -3,13 +3,19 @@
from __future__ import annotations
import asyncio
from typing import Any
import pyotgw
from pyotgw import vars as gw_vars
from serial import SerialException
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import (
CONF_DEVICE,
CONF_ID,
@ -80,7 +86,9 @@ class OpenThermGwConfigFlow(ConfigFlow, domain=DOMAIN):
return self._show_form()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle manual initiation of the config flow."""
return await self.async_step_init(user_input)

View file

@ -1,9 +1,10 @@
"""Config flow for OwnTracks."""
import secrets
from typing import Any
from homeassistant.components import cloud, webhook
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_WEBHOOK_ID
from .const import DOMAIN
@ -18,7 +19,9 @@ class OwnTracksFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a user initiated set up flow to create OwnTracks webhook."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")

View file

@ -87,7 +87,9 @@ class PicnicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Perform the re-auth step upon an API authentication error."""
return await self.async_step_user()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the authentication step, this is the generic step for both `step_user` and `step_reauth`."""
if user_input is None:
return self.async_show_form(

View file

@ -3,12 +3,13 @@
import asyncio
from collections import OrderedDict
import logging
from typing import Any
from pypoint import PointSession
import voluptuous as vol
from homeassistant.components.http import KEY_HASS, HomeAssistantView
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -59,7 +60,9 @@ class PointFlowHandler(ConfigFlow, domain=DOMAIN):
return await self.async_step_auth()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start."""
flows = self.hass.data.get(DATA_FLOW_IMPL, {})

View file

@ -1,6 +1,8 @@
"""Config flow for Profiler integration."""
from homeassistant.config_entries import ConfigFlow
from typing import Any
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from .const import DEFAULT_NAME, DOMAIN
@ -10,7 +12,9 @@ class ProfilerConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")

View file

@ -51,7 +51,9 @@ class ProsegurConfigFlow(ConfigFlow, domain=DOMAIN):
user_input: dict
contracts: list[dict[str, str]]
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -4,6 +4,7 @@ from __future__ import annotations
from http import HTTPStatus
import logging
from typing import Any
from rachiopy import Rachio
from requests.exceptions import ConnectTimeout
@ -67,7 +68,9 @@ class RachioConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,6 +1,7 @@
"""Config flow for Smappee."""
import logging
from typing import Any
from pysmappee import helper, mqtt
import voluptuous as vol
@ -106,7 +107,9 @@ class SmappeeFlowHandler(
data={CONF_IP_ADDRESS: ip_address, CONF_SERIALNUMBER: serial_number},
)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
# If there is a CLOUD entry already, abort a new LOCAL entry

View file

@ -1,6 +1,7 @@
"""Config flow for Smart Meter Texas integration."""
import logging
from typing import Any
from aiohttp import ClientError
from smart_meter_texas import Account, Client, ClientSSLContext
@ -10,7 +11,7 @@ from smart_meter_texas.exceptions import (
)
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -52,7 +53,9 @@ class SMTConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -2,13 +2,14 @@
from http import HTTPStatus
import logging
from typing import Any
from aiohttp import ClientResponseError
from pysmartthings import APIResponseError, AppOAuth, SmartThings
from pysmartthings.installedapp import format_install_url
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -57,7 +58,9 @@ class SmartThingsFlowHandler(ConfigFlow, domain=DOMAIN):
"""Occurs when a previously entry setup fails and is re-initiated."""
return await self.async_step_user(user_input)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Validate and confirm webhook setup."""
if not self.endpoints_initialized:
self.endpoints_initialized = True

View file

@ -1,12 +1,13 @@
"""Config flow for Soma."""
import logging
from typing import Any
from api.soma_api import SomaApi
from requests import RequestException
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST, CONF_PORT
from .const import DOMAIN
@ -24,7 +25,9 @@ class SomaFlowHandler(ConfigFlow, domain=DOMAIN):
def __init__(self) -> None:
"""Instantiate config flow."""
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start."""
if user_input is None:
data = {

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from urllib.parse import urlparse
from songpal import Device, SongpalException
@ -36,7 +37,9 @@ class SongpalConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the flow."""
self.conf: SongpalConfig | None = None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
if user_input is None:
return self.async_show_form(

View file

@ -1,11 +1,12 @@
"""Config flow for Spider."""
import logging
from typing import Any
from spiderpy.spiderapi import SpiderApi, SpiderApiException, UnauthorizedException
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
@ -49,7 +50,9 @@ class SpiderConfigFlow(ConfigFlow, domain=DOMAIN):
return RESULT_SUCCESS
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")

View file

@ -131,7 +131,9 @@ class SqueezeboxConfigFlow(ConfigFlow, domain=DOMAIN):
return None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
errors = {}
if user_input and CONF_HOST in user_input:

View file

@ -2,10 +2,12 @@
from __future__ import annotations
from typing import Any
from starline import StarlineAuth
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
@ -52,7 +54,9 @@ class StarlineFlowHandler(ConfigFlow, domain=DOMAIN):
self._auth = StarlineAuth()
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow initialized by the user."""
return await self.async_step_auth_app(user_input)

View file

@ -1,9 +1,11 @@
"""Config flow for syncthing integration."""
from typing import Any
import aiosyncthing
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -42,7 +44,9 @@ class SyncThingConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}

View file

@ -1,6 +1,7 @@
"""Config flow for Samsung SyncThru."""
import re
from typing import Any
from urllib.parse import urlparse
from pysyncthru import ConnectionMode, SyncThru, SyncThruAPINotSupported
@ -23,7 +24,9 @@ class SyncThruConfigFlow(ConfigFlow, domain=DOMAIN):
url: str
name: str
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle user initiated flow."""
if user_input is None:
return await self._async_show_form(step_id="user")

View file

@ -3,11 +3,12 @@
import asyncio
import logging
import os
from typing import Any
from tellduslive import Session, supports_local_api
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_HOST
from homeassistant.util.json import load_json_object
@ -50,7 +51,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
)
return self._session.authorize_url
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Let user select host or cloud."""
if self._async_current_entries():
return self.async_abort(reason="already_setup")

View file

@ -28,7 +28,9 @@ class TwinklyConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the config flow."""
self._discovered_device: tuple[dict[str, Any], str] | None = None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle config steps."""
host = user_input[CONF_HOST] if user_input else None

View file

@ -3,12 +3,13 @@
import asyncio
from contextlib import suppress
import logging
from typing import Any
from urllib.parse import urlparse
import upb_lib
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ADDRESS, CONF_FILE_PATH, CONF_HOST, CONF_PROTOCOL
from homeassistant.exceptions import HomeAssistantError
@ -82,7 +83,9 @@ class UPBConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize the UPB config flow."""
self.importing = False
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,6 +1,7 @@
"""Config flow for Vilfo Router integration."""
import logging
from typing import Any
from vilfo import Client as VilfoClient
from vilfo.exceptions import (
@ -9,7 +10,7 @@ from vilfo.exceptions import (
)
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_ID, CONF_MAC
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
@ -99,7 +100,9 @@ class DomainConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from typing import Any
from pyvolumio import CannotConnectError, Volumio
import voluptuous as vol
@ -68,7 +69,9 @@ class VolumioConfigFlow(ConfigFlow, domain=DOMAIN):
}
)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -44,7 +44,9 @@ class VulcanFlowHandler(ConfigFlow, domain=DOMAIN):
self.keystore = None
self.students = None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle config flow."""
if self._async_current_entries():
return await self.async_step_add_next_config_entry()

View file

@ -6,11 +6,17 @@ Used by UI to setup a wiffi integration.
from __future__ import annotations
import errno
from typing import Any
import voluptuous as vol
from wiffi import WiffiTcpServer
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_PORT, CONF_TIMEOUT
from homeassistant.core import callback
@ -30,7 +36,9 @@ class WiffiFlowHandler(ConfigFlow, domain=DOMAIN):
"""Create Wiffi server setup option flow."""
return OptionsFlowHandler(config_entry)
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the start of the config flow.
Called after wiffi integration has been selected in the 'add integration

View file

@ -1,13 +1,14 @@
"""Config flow for Wolf SmartSet Service integration."""
import logging
from typing import Any
from httpcore import ConnectError
import voluptuous as vol
from wolf_comm.token_auth import InvalidAuth
from wolf_comm.wolf_client import WolfClient
from homeassistant.config_entries import ConfigFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from .const import DEVICE_GATEWAY, DEVICE_ID, DEVICE_NAME, DOMAIN
@ -30,7 +31,9 @@ class WolfLinkConfigFlow(ConfigFlow, domain=DOMAIN):
self.password = None
self.fetched_systems = None
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step to get connection parameters."""
errors = {}
if user_input is not None:

View file

@ -8,7 +8,12 @@ from typing import Any
from pyws66i import WS66i, get_ws66i
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_IP_ADDRESS
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
@ -94,7 +99,9 @@ class WS66iConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:

View file

@ -1,7 +1,9 @@
"""Config flow for xbox."""
import logging
from typing import Any
from homeassistant.config_entries import ConfigFlowResult
from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN
@ -25,7 +27,9 @@ class OAuth2FlowHandler(
scopes = ["Xboxlive.signin", "Xboxlive.offline_access"]
return {"scope": " ".join(scopes)}
async def async_step_user(self, user_input=None):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a flow start."""
await self.async_set_unique_id(DOMAIN)