Rename FlowResultDict to FlowResult (#49847)

This commit is contained in:
Ruslan Sayfutdinov 2021-04-29 12:40:51 +01:00 committed by GitHub
parent 8be6605be9
commit 183220008d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 229 additions and 269 deletions

View file

@ -11,7 +11,7 @@ import jwt
from homeassistant import data_entry_flow from homeassistant import data_entry_flow
from homeassistant.auth.const import ACCESS_TOKEN_EXPIRATION from homeassistant.auth.const import ACCESS_TOKEN_EXPIRATION
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
from . import auth_store, models from . import auth_store, models
@ -98,8 +98,8 @@ class AuthManagerFlowManager(data_entry_flow.FlowManager):
return await auth_provider.async_login_flow(context) return await auth_provider.async_login_flow(context)
async def async_finish_flow( async def async_finish_flow(
self, flow: data_entry_flow.FlowHandler, result: FlowResultDict self, flow: data_entry_flow.FlowHandler, result: FlowResult
) -> FlowResultDict: ) -> FlowResult:
"""Return a user as result of login flow.""" """Return a user as result of login flow."""
flow = cast(LoginFlow, flow) flow = cast(LoginFlow, flow)

View file

@ -12,7 +12,7 @@ from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements from homeassistant import data_entry_flow, requirements
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TYPE from homeassistant.const import CONF_ID, CONF_NAME, CONF_TYPE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.util.decorator import Registry from homeassistant.util.decorator import Registry
@ -106,7 +106,7 @@ class SetupFlow(data_entry_flow.FlowHandler):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the first step of setup flow. """Handle the first step of setup flow.
Return self.async_show_form(step_id='init') if user_input is None. Return self.async_show_form(step_id='init') if user_input is None.

View file

@ -14,7 +14,7 @@ import voluptuous as vol
from homeassistant.const import CONF_EXCLUDE, CONF_INCLUDE from homeassistant.const import CONF_EXCLUDE, CONF_INCLUDE
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import ServiceNotFound from homeassistant.exceptions import ServiceNotFound
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
@ -293,7 +293,7 @@ class NotifySetupFlow(SetupFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Let user select available notify services.""" """Let user select available notify services."""
errors: dict[str, str] = {} errors: dict[str, str] = {}
@ -319,7 +319,7 @@ class NotifySetupFlow(SetupFlow):
async def async_step_setup( async def async_step_setup(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Verify user can receive one-time password.""" """Verify user can receive one-time password."""
errors: dict[str, str] = {} errors: dict[str, str] = {}

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.auth.models import User from homeassistant.auth.models import User
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from . import ( from . import (
MULTI_FACTOR_AUTH_MODULE_SCHEMA, MULTI_FACTOR_AUTH_MODULE_SCHEMA,
@ -190,7 +190,7 @@ class TotpSetupFlow(SetupFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the first step of setup flow. """Handle the first step of setup flow.
Return self.async_show_form(step_id='init') if user_input is None. Return self.async_show_form(step_id='init') if user_input is None.

View file

@ -13,7 +13,7 @@ from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements from homeassistant import data_entry_flow, requirements
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TYPE from homeassistant.const import CONF_ID, CONF_NAME, CONF_TYPE
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
from homeassistant.util.decorator import Registry from homeassistant.util.decorator import Registry
@ -200,7 +200,7 @@ class LoginFlow(data_entry_flow.FlowHandler):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the first step of login flow. """Handle the first step of login flow.
Return self.async_show_form(step_id='init') if user_input is None. Return self.async_show_form(step_id='init') if user_input is None.
@ -210,7 +210,7 @@ class LoginFlow(data_entry_flow.FlowHandler):
async def async_step_select_mfa_module( async def async_step_select_mfa_module(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of select mfa module.""" """Handle the step of select mfa module."""
errors = {} errors = {}
@ -235,7 +235,7 @@ class LoginFlow(data_entry_flow.FlowHandler):
async def async_step_mfa( async def async_step_mfa(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of mfa validation.""" """Handle the step of mfa validation."""
assert self.credential assert self.credential
assert self.user assert self.user
@ -287,6 +287,6 @@ class LoginFlow(data_entry_flow.FlowHandler):
errors=errors, errors=errors,
) )
async def async_finish(self, flow_result: Any) -> FlowResultDict: async def async_finish(self, flow_result: Any) -> FlowResult:
"""Handle the pass of login flow.""" """Handle the pass of login flow."""
return self.async_create_entry(title=self._auth_provider.name, data=flow_result) return self.async_create_entry(title=self._auth_provider.name, data=flow_result)

View file

@ -11,7 +11,7 @@ from typing import Any, cast
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_COMMAND from homeassistant.const import CONF_COMMAND
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
@ -129,7 +129,7 @@ class CommandLineLoginFlow(LoginFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of the form.""" """Handle the step of the form."""
errors = {} errors = {}

View file

@ -13,7 +13,7 @@ import voluptuous as vol
from homeassistant.const import CONF_ID from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
@ -321,7 +321,7 @@ class HassLoginFlow(LoginFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of the form.""" """Handle the step of the form."""
errors = {} errors = {}

View file

@ -9,7 +9,7 @@ from typing import cast
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
@ -99,7 +99,7 @@ class ExampleLoginFlow(LoginFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of the form.""" """Handle the step of the form."""
errors = {} errors = {}

View file

@ -12,7 +12,7 @@ from typing import cast
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -84,7 +84,7 @@ class LegacyLoginFlow(LoginFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of the form.""" """Handle the step of the form."""
errors = {} errors = {}

View file

@ -19,7 +19,7 @@ from typing import Any, Dict, List, Union, cast
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -201,7 +201,7 @@ class TrustedNetworksLoginFlow(LoginFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the step of the form.""" """Handle the step of the form."""
try: try:
cast( cast(

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DOMAIN from .const import DOMAIN
@ -32,7 +32,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
async def _show_setup_form( async def _show_setup_form(
self, errors: dict[str, str] | None = None self, errors: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
@ -51,7 +51,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
async def _show_hassio_form( async def _show_hassio_form(
self, errors: dict[str, str] | None = None self, errors: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Show the Hass.io confirmation form to the user.""" """Show the Hass.io confirmation form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="hassio_confirm", step_id="hassio_confirm",
@ -62,7 +62,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return await self._show_setup_form(user_input) return await self._show_setup_form(user_input)
@ -107,7 +107,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
}, },
) )
async def async_step_hassio(self, discovery_info: dict[str, Any]) -> FlowResultDict: async def async_step_hassio(self, discovery_info: dict[str, Any]) -> FlowResult:
"""Prepare configuration for a Hass.io AdGuard Home add-on. """Prepare configuration for a Hass.io AdGuard Home add-on.
This flow is triggered by the discovery component. This flow is triggered by the discovery component.
@ -119,7 +119,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_hassio_confirm( async def async_step_hassio_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Confirm Supervisor discovery.""" """Confirm Supervisor discovery."""
if user_input is None: if user_input is None:
return await self._show_hassio_form() return await self._show_hassio_form()

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
HTTP_UNAUTHORIZED, HTTP_UNAUTHORIZED,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import DiscoveryInfoType from homeassistant.helpers.typing import DiscoveryInfoType
@ -94,7 +94,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf( async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initialized by zeroconf discovery.""" """Handle a flow initialized by zeroconf discovery."""
name: str = discovery_info[CONF_NAME] name: str = discovery_info[CONF_NAME]
host: str = discovery_info[CONF_HOST] host: str = discovery_info[CONF_HOST]
@ -118,7 +118,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_confirm( async def async_step_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle confirmation flow for discovered bond hub.""" """Handle confirmation flow for discovered bond hub."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:
@ -159,7 +159,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View file

@ -8,7 +8,7 @@ import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -23,9 +23,7 @@ class BSBLanFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return self._show_setup_form() return self._show_setup_form()
@ -57,7 +55,7 @@ class BSBLanFlowHandler(ConfigFlow, domain=DOMAIN):
}, },
) )
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict: def _show_setup_form(self, errors: dict | None = None) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",

View file

@ -11,7 +11,7 @@ import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow, OptionsFlow from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow, OptionsFlow
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
@ -53,13 +53,11 @@ class CanaryConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, user_input: ConfigType | None = None self, user_input: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by configuration file.""" """Handle a flow initiated by configuration file."""
return await self.async_step_user(user_input) return await self.async_step_user(user_input)
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View file

@ -22,7 +22,7 @@ from homeassistant.const import (
CONF_NAME, CONF_NAME,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -88,9 +88,7 @@ class ClimaCellOptionsConfigFlow(config_entries.OptionsFlow):
"""Initialize ClimaCell options flow.""" """Initialize ClimaCell options flow."""
self._config_entry = config_entry self._config_entry = config_entry
async def async_step_init( async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult:
self, user_input: dict[str, Any] = None
) -> FlowResultDict:
"""Manage the ClimaCell options.""" """Manage the ClimaCell options."""
if user_input is not None: if user_input is not None:
return self.async_create_entry(title="", data=user_input) return self.async_create_entry(title="", data=user_input)
@ -121,9 +119,7 @@ class ClimaCellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return ClimaCellOptionsConfigFlow(config_entry) return ClimaCellOptionsConfigFlow(config_entry)
async def async_step_user( async def async_step_user(self, user_input: dict[str, Any] = None) -> FlowResult:
self, user_input: dict[str, Any] = None
) -> FlowResultDict:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View file

@ -6,7 +6,7 @@ from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from . import get_coordinator from . import get_coordinator
from .const import DOMAIN, OPTION_WORLDWIDE from .const import DOMAIN, OPTION_WORLDWIDE
@ -22,7 +22,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors: dict[str, str] = {} errors: dict[str, str] = {}

View file

@ -13,7 +13,7 @@ from homeassistant import config_entries
from homeassistant.components import ssdp from homeassistant.components import ssdp
from homeassistant.const import CONF_HOST, CONF_TYPE from homeassistant.const import CONF_HOST, CONF_TYPE
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.httpx_client import get_async_client from homeassistant.helpers.httpx_client import get_async_client
from .receiver import ConnectDenonAVR from .receiver import ConnectDenonAVR
@ -135,7 +135,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_select( async def async_step_select(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle multiple receivers found.""" """Handle multiple receivers found."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:
@ -156,7 +156,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_confirm( async def async_step_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Allow the user to confirm adding the device.""" """Allow the user to confirm adding the device."""
if user_input is not None: if user_input is not None:
return await self.async_step_connect() return await self.async_step_connect()
@ -166,7 +166,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_connect( async def async_step_connect(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Connect to the receiver.""" """Connect to the receiver."""
connect_denonavr = ConnectDenonAVR( connect_denonavr = ConnectDenonAVR(
self.host, self.host,
@ -215,7 +215,7 @@ class DenonAvrFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
}, },
) )
async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> FlowResultDict: async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> FlowResult:
"""Handle a discovered Denon AVR. """Handle a discovered Denon AVR.
This flow is triggered by the SSDP component. It will check if the This flow is triggered by the SSDP component. It will check if the

View file

@ -12,7 +12,7 @@ from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -46,9 +46,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
"""Set up the instance.""" """Set up the instance."""
self.discovery_info = {} self.discovery_info = {}
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return self._show_setup_form() return self._show_setup_form()
@ -68,9 +66,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=user_input[CONF_HOST], data=user_input) return self.async_create_entry(title=user_input[CONF_HOST], data=user_input)
async def async_step_ssdp( async def async_step_ssdp(self, discovery_info: DiscoveryInfoType) -> FlowResult:
self, discovery_info: DiscoveryInfoType
) -> FlowResultDict:
"""Handle SSDP discovery.""" """Handle SSDP discovery."""
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
receiver_id = None receiver_id = None
@ -103,7 +99,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_ssdp_confirm( async def async_step_ssdp_confirm(
self, user_input: ConfigType = None self, user_input: ConfigType = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a confirmation flow initiated by SSDP.""" """Handle a confirmation flow initiated by SSDP."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -117,7 +113,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
data=self.discovery_info, data=self.discovery_info,
) )
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict: def _show_setup_form(self, errors: dict | None = None) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_SERIAL_NUMBER, DOMAIN from .const import CONF_SERIAL_NUMBER, DOMAIN
@ -27,7 +27,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return self._async_show_setup_form() return self._async_show_setup_form()
@ -42,9 +42,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
return self._async_create_entry() return self._async_create_entry()
async def async_step_zeroconf( async def async_step_zeroconf(self, discovery_info: dict[str, Any]) -> FlowResult:
self, discovery_info: dict[str, Any]
) -> FlowResultDict:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
self.host = discovery_info[CONF_HOST] self.host = discovery_info[CONF_HOST]
self.port = discovery_info[CONF_PORT] self.port = discovery_info[CONF_PORT]
@ -62,14 +60,14 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf_confirm( async def async_step_zeroconf_confirm(
self, _: dict[str, Any] | None = None self, _: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by zeroconf.""" """Handle a flow initiated by zeroconf."""
return self._async_create_entry() return self._async_create_entry()
@callback @callback
def _async_show_setup_form( def _async_show_setup_form(
self, errors: dict[str, str] | None = None self, errors: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
@ -83,7 +81,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
) )
@callback @callback
def _async_create_entry(self) -> FlowResultDict: def _async_create_entry(self) -> FlowResult:
return self.async_create_entry( return self.async_create_entry(
title=self.serial_number, title=self.serial_number,
data={ data={

View file

@ -17,7 +17,7 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.httpx_client import get_async_client from homeassistant.helpers.httpx_client import get_async_client
@ -132,7 +132,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors = {} errors = {}

View file

@ -4,7 +4,7 @@ from __future__ import annotations
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from .const import ( from .const import (
_LOGGER, _LOGGER,
@ -28,11 +28,11 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
"""Initialize HomematicIP Cloud config flow.""" """Initialize HomematicIP Cloud config flow."""
self.auth = None self.auth = None
async def async_step_user(self, user_input=None) -> FlowResultDict: async def async_step_user(self, user_input=None) -> FlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
return await self.async_step_init(user_input) return await self.async_step_init(user_input)
async def async_step_init(self, user_input=None) -> FlowResultDict: async def async_step_init(self, user_input=None) -> FlowResult:
"""Handle a flow start.""" """Handle a flow start."""
errors = {} errors = {}
@ -63,7 +63,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
errors=errors, errors=errors,
) )
async def async_step_link(self, user_input=None) -> FlowResultDict: async def async_step_link(self, user_input=None) -> FlowResult:
"""Attempt to link with the HomematicIP Cloud access point.""" """Attempt to link with the HomematicIP Cloud access point."""
errors = {} errors = {}
@ -85,7 +85,7 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
return self.async_show_form(step_id="link", errors=errors) return self.async_show_form(step_id="link", errors=errors)
async def async_step_import(self, import_info) -> FlowResultDict: async def async_step_import(self, import_info) -> FlowResult:
"""Import a new access point as a config entry.""" """Import a new access point as a config entry."""
hapid = import_info[HMIPC_HAPID].replace("-", "").upper() hapid = import_info[HMIPC_HAPID].replace("-", "").upper()
authtoken = import_info[HMIPC_AUTHTOKEN] authtoken = import_info[HMIPC_AUTHTOKEN]

View file

@ -29,7 +29,7 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.typing import DiscoveryInfoType from homeassistant.helpers.typing import DiscoveryInfoType
from .const import ( from .const import (
@ -62,7 +62,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self, self,
user_input: dict[str, Any] | None = None, user_input: dict[str, Any] | None = None,
errors: dict[str, str] | None = None, errors: dict[str, str] | None = None,
) -> FlowResultDict: ) -> FlowResult:
if user_input is None: if user_input is None:
user_input = {} user_input = {}
return self.async_show_form( return self.async_show_form(
@ -89,7 +89,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle import initiated config flow.""" """Handle import initiated config flow."""
return await self.async_step_user(user_input) return await self.async_step_user(user_input)
@ -103,7 +103,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( # noqa: C901 async def async_step_user( # noqa: C901
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle user initiated config flow.""" """Handle user initiated config flow."""
if user_input is None: if user_input is None:
return await self._async_show_user_form() return await self._async_show_user_form()
@ -215,9 +215,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=title, data=user_input) return self.async_create_entry(title=title, data=user_input)
async def async_step_ssdp( async def async_step_ssdp(self, discovery_info: DiscoveryInfoType) -> FlowResult:
self, discovery_info: DiscoveryInfoType
) -> FlowResultDict:
"""Handle SSDP initiated config flow.""" """Handle SSDP initiated config flow."""
await self.async_set_unique_id(discovery_info[ssdp.ATTR_UPNP_UDN]) await self.async_set_unique_id(discovery_info[ssdp.ATTR_UPNP_UDN])
self._abort_if_unique_id_configured() self._abort_if_unique_id_configured()
@ -258,7 +256,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle options flow.""" """Handle options flow."""
# Recipients are persisted as a list, but handled as comma separated string in UI # Recipients are persisted as a list, but handled as comma separated string in UI

View file

@ -14,7 +14,7 @@ from homeassistant import config_entries, core
from homeassistant.components import ssdp from homeassistant.components import ssdp
from homeassistant.const import CONF_HOST, CONF_USERNAME from homeassistant.const import CONF_HOST, CONF_USERNAME
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import aiohttp_client from homeassistant.helpers import aiohttp_client
from .bridge import authenticate_bridge from .bridge import authenticate_bridge
@ -118,7 +118,7 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_manual( async def async_step_manual(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle manual bridge setup.""" """Handle manual bridge setup."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -253,7 +253,7 @@ class HueOptionsFlowHandler(config_entries.OptionsFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Manage Hue options.""" """Manage Hue options."""
if user_input is not None: if user_input is not None:
return self.async_create_entry(title="", data=user_input) return self.async_create_entry(title="", data=user_input)

View file

@ -27,7 +27,7 @@ from homeassistant.const import (
CONF_TOKEN, CONF_TOKEN,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -131,7 +131,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def _advance_to_auth_step_if_necessary( async def _advance_to_auth_step_if_necessary(
self, hyperion_client: client.HyperionClient self, hyperion_client: client.HyperionClient
) -> FlowResultDict: ) -> FlowResult:
"""Determine if auth is required.""" """Determine if auth is required."""
auth_resp = await hyperion_client.async_is_auth_required() auth_resp = await hyperion_client.async_is_auth_required()
@ -146,7 +146,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_reauth( async def async_step_reauth(
self, self,
config_data: ConfigType, config_data: ConfigType,
) -> FlowResultDict: ) -> FlowResult:
"""Handle a reauthentication flow.""" """Handle a reauthentication flow."""
self._data = dict(config_data) self._data = dict(config_data)
async with self._create_client(raw_connection=True) as hyperion_client: async with self._create_client(raw_connection=True) as hyperion_client:
@ -154,7 +154,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="cannot_connect") return self.async_abort(reason="cannot_connect")
return await self._advance_to_auth_step_if_necessary(hyperion_client) return await self._advance_to_auth_step_if_necessary(hyperion_client)
async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> FlowResultDict: async def async_step_ssdp(self, discovery_info: dict[str, Any]) -> FlowResult:
"""Handle a flow initiated by SSDP.""" """Handle a flow initiated by SSDP."""
# Sample data provided by SSDP: { # Sample data provided by SSDP: {
# 'ssdp_location': 'http://192.168.0.1:8090/description.xml', # 'ssdp_location': 'http://192.168.0.1:8090/description.xml',
@ -225,7 +225,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, self,
user_input: ConfigType | None = None, user_input: ConfigType | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
errors = {} errors = {}
if user_input: if user_input:
@ -296,7 +296,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_auth( async def async_step_auth(
self, self,
user_input: ConfigType | None = None, user_input: ConfigType | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Handle the auth step of a flow.""" """Handle the auth step of a flow."""
errors = {} errors = {}
if user_input: if user_input:
@ -325,7 +325,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_create_token( async def async_step_create_token(
self, user_input: ConfigType | None = None self, user_input: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Send a request for a new token.""" """Send a request for a new token."""
if user_input is None: if user_input is None:
self._auth_id = client.generate_random_auth_id() self._auth_id = client.generate_random_auth_id()
@ -351,7 +351,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_create_token_external( async def async_step_create_token_external(
self, auth_resp: ConfigType | None = None self, auth_resp: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle completion of the request for a new token.""" """Handle completion of the request for a new token."""
if auth_resp is not None and client.ResponseOK(auth_resp): if auth_resp is not None and client.ResponseOK(auth_resp):
token = auth_resp.get(const.KEY_INFO, {}).get(const.KEY_TOKEN) token = auth_resp.get(const.KEY_INFO, {}).get(const.KEY_TOKEN)
@ -364,7 +364,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_create_token_success( async def async_step_create_token_success(
self, _: ConfigType | None = None self, _: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Create an entry after successful token creation.""" """Create an entry after successful token creation."""
# Clean-up the request task. # Clean-up the request task.
await self._cancel_request_token_task() await self._cancel_request_token_task()
@ -380,7 +380,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_create_token_fail( async def async_step_create_token_fail(
self, _: ConfigType | None = None self, _: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Show an error on the auth form.""" """Show an error on the auth form."""
# Clean-up the request task. # Clean-up the request task.
await self._cancel_request_token_task() await self._cancel_request_token_task()
@ -388,7 +388,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_confirm( async def async_step_confirm(
self, user_input: ConfigType | None = None self, user_input: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Get final confirmation before entry creation.""" """Get final confirmation before entry creation."""
if user_input is None and self._require_confirm: if user_input is None and self._require_confirm:
return self.async_show_form( return self.async_show_form(
@ -448,7 +448,7 @@ class HyperionOptionsFlow(OptionsFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Manage the options.""" """Manage the options."""
effects = {source: source for source in const.KEY_COMPONENTID_EXTERNAL_SOURCES} effects = {source: source for source in const.KEY_COMPONENTID_EXTERNAL_SOURCES}

View file

@ -24,7 +24,7 @@ from homeassistant.const import (
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -63,9 +63,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
"""Set up the instance.""" """Set up the instance."""
self.discovery_info = {} self.discovery_info = {}
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return self._show_setup_form() return self._show_setup_form()
@ -101,7 +99,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=user_input[CONF_HOST], data=user_input) return self.async_create_entry(title=user_input[CONF_HOST], data=user_input)
async def async_step_zeroconf(self, discovery_info: ConfigType) -> FlowResultDict: async def async_step_zeroconf(self, discovery_info: ConfigType) -> FlowResult:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
port = discovery_info[CONF_PORT] port = discovery_info[CONF_PORT]
zctype = discovery_info["type"] zctype = discovery_info["type"]
@ -169,7 +167,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf_confirm( async def async_step_zeroconf_confirm(
self, user_input: ConfigType = None self, user_input: ConfigType = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a confirmation flow initiated by zeroconf.""" """Handle a confirmation flow initiated by zeroconf."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -183,7 +181,7 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
data=self.discovery_info, data=self.discovery_info,
) )
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict: def _show_setup_form(self, errors: dict | None = None) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",

View file

@ -10,7 +10,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_PORT from homeassistant.const import CONF_PORT
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN from .const import DOMAIN
@ -22,7 +22,7 @@ class LiteJetConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Create a LiteJet config entry based upon user input.""" """Create a LiteJet config entry based upon user input."""
if self.hass.config_entries.async_entries(DOMAIN): if self.hass.config_entries.async_entries(DOMAIN):
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View file

@ -6,7 +6,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME from homeassistant.const import CONF_ELEVATION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from .const import ( from .const import (
@ -80,7 +80,7 @@ class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors=self._errors, errors=self._errors,
) )
async def async_step_import(self, user_input: dict | None = None) -> FlowResultDict: async def async_step_import(self, user_input: dict | None = None) -> FlowResult:
"""Handle configuration by yaml file.""" """Handle configuration by yaml file."""
return await self.async_step_user(user_input) return await self.async_step_user(user_input)

View file

@ -11,7 +11,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from .const import DOMAIN from .const import DOMAIN
@ -46,7 +46,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View file

@ -27,7 +27,7 @@ from homeassistant.components.mysensors import (
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from . import CONF_RETAIN, CONF_VERSION, DEFAULT_VERSION from . import CONF_RETAIN, CONF_VERSION, DEFAULT_VERSION
@ -282,7 +282,7 @@ class MySensorsConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
@callback @callback
def _async_create_entry( def _async_create_entry(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Create the config entry.""" """Create the config entry."""
return self.async_create_entry( return self.async_create_entry(
title=f"{user_input[CONF_DEVICE]}", title=f"{user_input[CONF_DEVICE]}",

View file

@ -18,7 +18,7 @@ from homeassistant.const import (
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
@ -67,7 +67,7 @@ class NZBGetConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, user_input: ConfigType | None = None self, user_input: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by configuration file.""" """Handle a flow initiated by configuration file."""
if CONF_SCAN_INTERVAL in user_input: if CONF_SCAN_INTERVAL in user_input:
user_input[CONF_SCAN_INTERVAL] = user_input[ user_input[CONF_SCAN_INTERVAL] = user_input[
@ -76,9 +76,7 @@ class NZBGetConfigFlow(ConfigFlow, domain=DOMAIN):
return await self.async_step_user(user_input) return await self.async_step_user(user_input)
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN from .const import DOMAIN
@ -35,9 +35,7 @@ class PlumLightpadConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors or {}, errors=errors or {},
) )
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initialized by the user or redirected to by import.""" """Handle a flow initialized by the user or redirected to by import."""
if not user_input: if not user_input:
return self._show_form() return self._show_form()
@ -59,8 +57,6 @@ class PlumLightpadConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
title=username, data={CONF_USERNAME: username, CONF_PASSWORD: password} title=username, data={CONF_USERNAME: username, CONF_PASSWORD: password}
) )
async def async_step_import( async def async_step_import(self, import_config: ConfigType | None) -> FlowResult:
self, import_config: ConfigType | None
) -> FlowResultDict:
"""Import a config entry from configuration.yaml.""" """Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config) return await self.async_step_user(import_config)

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import ACCOUNT_HASH, DOMAIN from .const import ACCOUNT_HASH, DOMAIN
@ -28,7 +28,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
async def async_step_user(self, user_input=None) -> FlowResultDict: async def async_step_user(self, user_input=None) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
if user_input is None: if user_input is None:
return self.async_show_form(step_id="user", data_schema=DATA_SCHEMA) return self.async_show_form(step_id="user", data_schema=DATA_SCHEMA)

View file

@ -15,7 +15,7 @@ from homeassistant.components.ssdp import (
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DOMAIN from .const import DOMAIN
@ -54,7 +54,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
self.discovery_info = {} self.discovery_info = {}
@callback @callback
def _show_form(self, errors: dict | None = None) -> FlowResultDict: def _show_form(self, errors: dict | None = None) -> FlowResult:
"""Show the form to the user.""" """Show the form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
@ -62,7 +62,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
errors=errors or {}, errors=errors or {},
) )
async def async_step_user(self, user_input: dict | None = None) -> FlowResultDict: async def async_step_user(self, user_input: dict | None = None) -> FlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
if not user_input: if not user_input:
return self._show_form() return self._show_form()
@ -113,9 +113,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
return await self.async_step_discovery_confirm() return await self.async_step_discovery_confirm()
async def async_step_ssdp( async def async_step_ssdp(self, discovery_info: dict | None = None) -> FlowResult:
self, discovery_info: dict | None = None
) -> FlowResultDict:
"""Handle a flow initialized by discovery.""" """Handle a flow initialized by discovery."""
host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname host = urlparse(discovery_info[ATTR_SSDP_LOCATION]).hostname
name = discovery_info[ATTR_UPNP_FRIENDLY_NAME] name = discovery_info[ATTR_UPNP_FRIENDLY_NAME]
@ -141,7 +139,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_discovery_confirm( async def async_step_discovery_confirm(
self, user_input: dict | None = None self, user_input: dict | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle user-confirmation of discovered device.""" """Handle user-confirmation of discovered device."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View file

@ -7,7 +7,7 @@ from rpi_bad_power import new_under_voltage
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler
from .const import DOMAIN from .const import DOMAIN
@ -35,7 +35,7 @@ class RPiPowerFlow(DiscoveryFlowHandler, domain=DOMAIN):
async def async_step_onboarding( async def async_step_onboarding(
self, data: dict[str, Any] | None = None self, data: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initialized by onboarding.""" """Handle a flow initialized by onboarding."""
has_devices = await self._discovery_function(self.hass) has_devices = await self._discovery_function(self.hass)

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from .const import ( from .const import (
CONF_DSN, CONF_DSN,
@ -49,7 +49,7 @@ class SentryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a user config flow.""" """Handle a user config flow."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")
@ -80,7 +80,7 @@ class SentryOptionsFlow(config_entries.OptionsFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Manage Sentry options.""" """Manage Sentry options."""
if user_input is not None: if user_input is not None:
return self.async_create_entry(title="", data=user_input) return self.async_create_entry(title="", data=user_input)

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
CONF_SSL, CONF_SSL,
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -69,7 +69,7 @@ class SmaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""First step in config flow.""" """First step in config flow."""
errors = {} errors = {}
if user_input is not None: if user_input is not None:
@ -118,7 +118,7 @@ class SmaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, import_config: dict[str, Any] | None self, import_config: dict[str, Any] | None
) -> FlowResultDict: ) -> FlowResult:
"""Import a config flow from configuration.""" """Import a config flow from configuration."""
device_info = await validate_input(self.hass, import_config) device_info = await validate_input(self.hass, import_config)
import_config[DEVICE_INFO] = device_info import_config[DEVICE_INFO] = device_info

View file

@ -10,7 +10,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.const import CONF_API_KEY, CONF_NAME from homeassistant.const import CONF_API_KEY, CONF_NAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.util import slugify from homeassistant.util import slugify
from .const import CONF_SITE_ID, DEFAULT_NAME, DOMAIN from .const import CONF_SITE_ID, DEFAULT_NAME, DOMAIN
@ -57,7 +57,7 @@ class SolarEdgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Step when user initializes a integration.""" """Step when user initializes a integration."""
self._errors = {} self._errors = {}
if user_input is not None: if user_input is not None:
@ -93,7 +93,7 @@ class SolarEdgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Import a config entry.""" """Import a config entry."""
if self._site_in_configuration_exists(user_input[CONF_SITE_ID]): if self._site_in_configuration_exists(user_input[CONF_SITE_ID]):
return self.async_abort(reason="already_configured") return self.async_abort(reason="already_configured")

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -76,7 +76,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return SonarrOptionsFlowHandler(config_entry) return SonarrOptionsFlowHandler(config_entry)
async def async_step_reauth(self, data: ConfigType | None = None) -> FlowResultDict: async def async_step_reauth(self, data: ConfigType | None = None) -> FlowResult:
"""Handle configuration by re-auth.""" """Handle configuration by re-auth."""
self._reauth = True self._reauth = True
self._entry_data = dict(data) self._entry_data = dict(data)
@ -87,7 +87,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_reauth_confirm( async def async_step_reauth_confirm(
self, user_input: ConfigType | None = None self, user_input: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Confirm reauth dialog.""" """Confirm reauth dialog."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -99,9 +99,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
return await self.async_step_user() return await self.async_step_user()
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
errors = {} errors = {}
@ -138,9 +136,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN):
errors=errors, errors=errors,
) )
async def _async_reauth_update_entry( async def _async_reauth_update_entry(self, entry_id: str, data: dict) -> FlowResult:
self, entry_id: str, data: dict
) -> FlowResultDict:
"""Update existing config entry.""" """Update existing config entry."""
entry = self.hass.config_entries.async_get_entry(entry_id) entry = self.hass.config_entries.async_get_entry(entry_id)
self.hass.config_entries.async_update_entry(entry, data=data) self.hass.config_entries.async_update_entry(entry, data=data)

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import persistent_notification from homeassistant.components import persistent_notification
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_entry_oauth2_flow from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN, SPOTIFY_SCOPES from .const import DOMAIN, SPOTIFY_SCOPES
@ -39,7 +39,7 @@ class SpotifyFlowHandler(
"""Extra data that needs to be appended to the authorize url.""" """Extra data that needs to be appended to the authorize url."""
return {"scope": ",".join(SPOTIFY_SCOPES)} return {"scope": ",".join(SPOTIFY_SCOPES)}
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResultDict: async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult:
"""Create an entry for Spotify.""" """Create an entry for Spotify."""
spotify = Spotify(auth=data["token"]["access_token"]) spotify = Spotify(auth=data["token"]["access_token"])
@ -61,7 +61,7 @@ class SpotifyFlowHandler(
return self.async_create_entry(title=name, data=data) return self.async_create_entry(title=name, data=data)
async def async_step_reauth(self, entry: dict[str, Any]) -> FlowResultDict: async def async_step_reauth(self, entry: dict[str, Any]) -> FlowResult:
"""Perform reauth upon migration of old entries.""" """Perform reauth upon migration of old entries."""
if entry: if entry:
self.entry = entry self.entry = entry
@ -77,7 +77,7 @@ class SpotifyFlowHandler(
async def async_step_reauth_confirm( async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Confirm reauth dialog.""" """Confirm reauth dialog."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(

View file

@ -8,7 +8,7 @@ from toonapi import Agreement, Toon, ToonError
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler
@ -30,7 +30,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
"""Return logger.""" """Return logger."""
return logging.getLogger(__name__) return logging.getLogger(__name__)
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResultDict: async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult:
"""Test connection and load up agreements.""" """Test connection and load up agreements."""
self.data = data self.data = data
@ -50,7 +50,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
async def async_step_import( async def async_step_import(
self, config: dict[str, Any] | None = None self, config: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Start a configuration flow based on imported data. """Start a configuration flow based on imported data.
This step is merely here to trigger "discovery" when the `toon` This step is merely here to trigger "discovery" when the `toon`
@ -67,7 +67,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
async def async_step_agreement( async def async_step_agreement(
self, user_input: dict[str, Any] = None self, user_input: dict[str, Any] = None
) -> FlowResultDict: ) -> FlowResult:
"""Select Toon agreement to add.""" """Select Toon agreement to add."""
if len(self.agreements) == 1: if len(self.agreements) == 1:
return await self._create_entry(self.agreements[0]) return await self._create_entry(self.agreements[0])
@ -88,7 +88,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
agreement_index = agreements_list.index(user_input[CONF_AGREEMENT]) agreement_index = agreements_list.index(user_input[CONF_AGREEMENT])
return await self._create_entry(self.agreements[agreement_index]) return await self._create_entry(self.agreements[agreement_index])
async def _create_entry(self, agreement: Agreement) -> FlowResultDict: async def _create_entry(self, agreement: Agreement) -> FlowResult:
if CONF_MIGRATE in self.context: if CONF_MIGRATE in self.context:
await self.hass.config_entries.async_remove(self.context[CONF_MIGRATE]) await self.hass.config_entries.async_remove(self.context[CONF_MIGRATE])

View file

@ -13,7 +13,7 @@ import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.config_entries import ConfigFlow from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_ID from homeassistant.const import CONF_ID
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_HOUSE_LETTER, CONF_HOUSE_NUMBER, CONF_POST_CODE, DOMAIN from .const import CONF_HOUSE_LETTER, CONF_HOUSE_NUMBER, CONF_POST_CODE, DOMAIN
@ -27,7 +27,7 @@ class TwenteMilieuFlowHandler(ConfigFlow, domain=DOMAIN):
async def _show_setup_form( async def _show_setup_form(
self, errors: dict[str, str] | None = None self, errors: dict[str, str] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
@ -43,7 +43,7 @@ class TwenteMilieuFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
if user_input is None: if user_input is None:
return await self._show_setup_form(user_input) return await self._show_setup_form(user_input)

View file

@ -19,7 +19,7 @@ from homeassistant.config_entries import (
) )
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from .const import ( from .const import (
CONF_GIID, CONF_GIID,
@ -58,7 +58,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
errors: dict[str, str] = {} errors: dict[str, str] = {}
@ -97,7 +97,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_installation( async def async_step_installation(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Select Verisure installation to add.""" """Select Verisure installation to add."""
if len(self.installations) == 1: if len(self.installations) == 1:
user_input = {CONF_GIID: list(self.installations)[0]} user_input = {CONF_GIID: list(self.installations)[0]}
@ -125,14 +125,14 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
}, },
) )
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResultDict: async def async_step_reauth(self, data: dict[str, Any]) -> FlowResult:
"""Handle initiation of re-authentication with Verisure.""" """Handle initiation of re-authentication with Verisure."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
return await self.async_step_reauth_confirm() return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm( async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle re-authentication with Verisure.""" """Handle re-authentication with Verisure."""
errors: dict[str, str] = {} errors: dict[str, str] = {}
@ -174,7 +174,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors, errors=errors,
) )
async def async_step_import(self, user_input: dict[str, Any]) -> FlowResultDict: async def async_step_import(self, user_input: dict[str, Any]) -> FlowResult:
"""Import Verisure YAML configuration.""" """Import Verisure YAML configuration."""
if user_input[CONF_GIID]: if user_input[CONF_GIID]:
self.giid = user_input[CONF_GIID] self.giid = user_input[CONF_GIID]
@ -204,7 +204,7 @@ class VerisureOptionsFlowHandler(OptionsFlow):
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Manage Verisure options.""" """Manage Verisure options."""
errors = {} errors = {}

View file

@ -30,7 +30,7 @@ from homeassistant.const import (
CONF_TYPE, CONF_TYPE,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import DiscoveryInfoType from homeassistant.helpers.typing import DiscoveryInfoType
@ -110,9 +110,7 @@ class VizioOptionsConfigFlow(config_entries.OptionsFlow):
"""Initialize vizio options flow.""" """Initialize vizio options flow."""
self.config_entry = config_entry self.config_entry = config_entry
async def async_step_init( async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult:
self, user_input: dict[str, Any] = None
) -> FlowResultDict:
"""Manage the vizio options.""" """Manage the vizio options."""
if user_input is not None: if user_input is not None:
if user_input.get(CONF_APPS_TO_INCLUDE_OR_EXCLUDE): if user_input.get(CONF_APPS_TO_INCLUDE_OR_EXCLUDE):
@ -194,7 +192,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self._data = None self._data = None
self._apps = {} self._apps = {}
async def _create_entry(self, input_dict: dict[str, Any]) -> FlowResultDict: async def _create_entry(self, input_dict: dict[str, Any]) -> FlowResult:
"""Create vizio config entry.""" """Create vizio config entry."""
# Remove extra keys that will not be used by entry setup # Remove extra keys that will not be used by entry setup
input_dict.pop(CONF_APPS_TO_INCLUDE_OR_EXCLUDE, None) input_dict.pop(CONF_APPS_TO_INCLUDE_OR_EXCLUDE, None)
@ -205,9 +203,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=input_dict[CONF_NAME], data=input_dict) return self.async_create_entry(title=input_dict[CONF_NAME], data=input_dict)
async def async_step_user( async def async_step_user(self, user_input: dict[str, Any] = None) -> FlowResult:
self, user_input: dict[str, Any] = None
) -> FlowResultDict:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
errors = {} errors = {}
@ -280,7 +276,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_show_form(step_id="user", data_schema=schema, errors=errors) return self.async_show_form(step_id="user", data_schema=schema, errors=errors)
async def async_step_import(self, import_config: dict[str, Any]) -> FlowResultDict: async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult:
"""Import a config entry from configuration.yaml.""" """Import a config entry from configuration.yaml."""
# Check if new config entry matches any existing config entries # Check if new config entry matches any existing config entries
for entry in self.hass.config_entries.async_entries(DOMAIN): for entry in self.hass.config_entries.async_entries(DOMAIN):
@ -344,7 +340,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf( async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType | None = None self, discovery_info: DiscoveryInfoType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
# If host already has port, no need to add it again # If host already has port, no need to add it again
if ":" not in discovery_info[CONF_HOST]: if ":" not in discovery_info[CONF_HOST]:
@ -379,9 +375,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self._must_show_form = True self._must_show_form = True
return await self.async_step_user(user_input=discovery_info) return await self.async_step_user(user_input=discovery_info)
async def async_step_pair_tv( async def async_step_pair_tv(self, user_input: dict[str, Any] = None) -> FlowResult:
self, user_input: dict[str, Any] = None
) -> FlowResultDict:
""" """
Start pairing process for TV. Start pairing process for TV.
@ -446,7 +440,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors, errors=errors,
) )
async def _pairing_complete(self, step_id: str) -> FlowResultDict: async def _pairing_complete(self, step_id: str) -> FlowResult:
"""Handle config flow completion.""" """Handle config flow completion."""
if not self._must_show_form: if not self._must_show_form:
return await self._create_entry(self._data) return await self._create_entry(self._data)
@ -460,7 +454,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_pairing_complete( async def async_step_pairing_complete(
self, user_input: dict[str, Any] = None self, user_input: dict[str, Any] = None
) -> FlowResultDict: ) -> FlowResult:
""" """
Complete non-import sourced config flow. Complete non-import sourced config flow.
@ -470,7 +464,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_pairing_complete_import( async def async_step_pairing_complete_import(
self, user_input: dict[str, Any] = None self, user_input: dict[str, Any] = None
) -> FlowResultDict: ) -> FlowResult:
""" """
Complete import sourced config flow. Complete import sourced config flow.

View file

@ -10,7 +10,7 @@ from homeassistant.config_entries import (
ConfigFlow, ConfigFlow,
) )
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
@ -23,15 +23,13 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL CONNECTION_CLASS = CONN_CLASS_LOCAL_POLL
async def async_step_user( async def async_step_user(self, user_input: ConfigType | None = None) -> FlowResult:
self, user_input: ConfigType | None = None
) -> FlowResultDict:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
return await self._handle_config_flow(user_input) return await self._handle_config_flow(user_input)
async def async_step_zeroconf( async def async_step_zeroconf(
self, discovery_info: ConfigType | None = None self, discovery_info: ConfigType | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
if discovery_info is None: if discovery_info is None:
return self.async_abort(reason="cannot_connect") return self.async_abort(reason="cannot_connect")
@ -54,13 +52,13 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf_confirm( async def async_step_zeroconf_confirm(
self, user_input: ConfigType = None self, user_input: ConfigType = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initiated by zeroconf.""" """Handle a flow initiated by zeroconf."""
return await self._handle_config_flow(user_input) return await self._handle_config_flow(user_input)
async def _handle_config_flow( async def _handle_config_flow(
self, user_input: ConfigType | None = None, prepare: bool = False self, user_input: ConfigType | None = None, prepare: bool = False
) -> FlowResultDict: ) -> FlowResult:
"""Config flow handler for WLED.""" """Config flow handler for WLED."""
source = self.context.get("source") source = self.context.get("source")
@ -101,7 +99,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
data={CONF_HOST: user_input[CONF_HOST], CONF_MAC: user_input[CONF_MAC]}, data={CONF_HOST: user_input[CONF_HOST], CONF_MAC: user_input[CONF_MAC]},
) )
def _show_setup_form(self, errors: dict | None = None) -> FlowResultDict: def _show_setup_form(self, errors: dict | None = None) -> FlowResult:
"""Show the setup form to the user.""" """Show the setup form to the user."""
return self.async_show_form( return self.async_show_form(
step_id="user", step_id="user",
@ -109,7 +107,7 @@ class WLEDFlowHandler(ConfigFlow, domain=DOMAIN):
errors=errors or {}, errors=errors or {},
) )
def _show_confirm_dialog(self, errors: dict | None = None) -> FlowResultDict: def _show_confirm_dialog(self, errors: dict | None = None) -> FlowResult:
"""Show the confirm dialog to the user.""" """Show the confirm dialog to the user."""
name = self.context.get(CONF_NAME) name = self.context.get(CONF_NAME)
return self.async_show_form( return self.async_show_form(

View file

@ -14,7 +14,7 @@ from homeassistant import config_entries, exceptions
from homeassistant.components.hassio import is_hassio from homeassistant.components.hassio import is_hassio
from homeassistant.const import CONF_URL from homeassistant.const import CONF_URL
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import AbortFlow, FlowResultDict from homeassistant.data_entry_flow import AbortFlow, FlowResult
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .addon import AddonError, AddonManager, get_addon_manager from .addon import AddonError, AddonManager, get_addon_manager
@ -89,7 +89,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle the initial step.""" """Handle the initial step."""
if is_hassio(self.hass): if is_hassio(self.hass):
return await self.async_step_on_supervisor() return await self.async_step_on_supervisor()
@ -98,7 +98,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_manual( async def async_step_manual(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a manual configuration.""" """Handle a manual configuration."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -134,7 +134,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
step_id="manual", data_schema=STEP_USER_DATA_SCHEMA, errors=errors step_id="manual", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
) )
async def async_step_hassio(self, discovery_info: dict[str, Any]) -> FlowResultDict: async def async_step_hassio(self, discovery_info: dict[str, Any]) -> FlowResult:
"""Receive configuration from add-on discovery info. """Receive configuration from add-on discovery info.
This flow is triggered by the Z-Wave JS add-on. This flow is triggered by the Z-Wave JS add-on.
@ -152,7 +152,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_hassio_confirm( async def async_step_hassio_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Confirm the add-on discovery.""" """Confirm the add-on discovery."""
if user_input is not None: if user_input is not None:
return await self.async_step_on_supervisor( return await self.async_step_on_supervisor(
@ -162,7 +162,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_show_form(step_id="hassio_confirm") return self.async_show_form(step_id="hassio_confirm")
@callback @callback
def _async_create_entry_from_vars(self) -> FlowResultDict: def _async_create_entry_from_vars(self) -> FlowResult:
"""Return a config entry for the flow.""" """Return a config entry for the flow."""
return self.async_create_entry( return self.async_create_entry(
title=TITLE, title=TITLE,
@ -177,7 +177,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_on_supervisor( async def async_step_on_supervisor(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle logic when on Supervisor host.""" """Handle logic when on Supervisor host."""
if user_input is None: if user_input is None:
return self.async_show_form( return self.async_show_form(
@ -201,7 +201,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_install_addon( async def async_step_install_addon(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Install Z-Wave JS add-on.""" """Install Z-Wave JS add-on."""
if not self.install_task: if not self.install_task:
self.install_task = self.hass.async_create_task(self._async_install_addon()) self.install_task = self.hass.async_create_task(self._async_install_addon())
@ -221,13 +221,13 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_install_failed( async def async_step_install_failed(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Add-on installation failed.""" """Add-on installation failed."""
return self.async_abort(reason="addon_install_failed") return self.async_abort(reason="addon_install_failed")
async def async_step_configure_addon( async def async_step_configure_addon(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Ask for config for Z-Wave JS add-on.""" """Ask for config for Z-Wave JS add-on."""
addon_config = await self._async_get_addon_config() addon_config = await self._async_get_addon_config()
@ -263,7 +263,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_start_addon( async def async_step_start_addon(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Start Z-Wave JS add-on.""" """Start Z-Wave JS add-on."""
if not self.start_task: if not self.start_task:
self.start_task = self.hass.async_create_task(self._async_start_addon()) self.start_task = self.hass.async_create_task(self._async_start_addon())
@ -281,7 +281,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_start_failed( async def async_step_start_failed(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Add-on start failed.""" """Add-on start failed."""
return self.async_abort(reason="addon_start_failed") return self.async_abort(reason="addon_start_failed")
@ -318,7 +318,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_finish_addon_setup( async def async_step_finish_addon_setup(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Prepare info needed to complete the config entry. """Prepare info needed to complete the config entry.
Get add-on discovery info and server version info. Get add-on discovery info and server version info.

View file

@ -579,8 +579,8 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager):
self._hass_config = hass_config self._hass_config = hass_config
async def async_finish_flow( async def async_finish_flow(
self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResultDict self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResult
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Finish a config flow and add an entry.""" """Finish a config flow and add an entry."""
flow = cast(ConfigFlow, flow) flow = cast(ConfigFlow, flow)
@ -688,7 +688,7 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager):
return flow return flow
async def async_post_init( async def async_post_init(
self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResultDict self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResult
) -> None: ) -> None:
"""After a flow is initialised trigger new flow notifications.""" """After a flow is initialised trigger new flow notifications."""
source = flow.context["source"] source = flow.context["source"]
@ -1190,7 +1190,7 @@ class ConfigFlow(data_entry_flow.FlowHandler):
@callback @callback
def _async_in_progress( def _async_in_progress(
self, include_uninitialized: bool = False self, include_uninitialized: bool = False
) -> list[data_entry_flow.FlowResultDict]: ) -> list[data_entry_flow.FlowResult]:
"""Return other in progress flows for current domain.""" """Return other in progress flows for current domain."""
return [ return [
flw flw
@ -1202,20 +1202,20 @@ class ConfigFlow(data_entry_flow.FlowHandler):
async def async_step_ignore( async def async_step_ignore(
self, user_input: dict[str, Any] self, user_input: dict[str, Any]
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Ignore this config flow.""" """Ignore this config flow."""
await self.async_set_unique_id(user_input["unique_id"], raise_on_progress=False) await self.async_set_unique_id(user_input["unique_id"], raise_on_progress=False)
return self.async_create_entry(title=user_input["title"], data={}) return self.async_create_entry(title=user_input["title"], data={})
async def async_step_unignore( async def async_step_unignore(
self, user_input: dict[str, Any] self, user_input: dict[str, Any]
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Rediscover a config entry by it's unique_id.""" """Rediscover a config entry by it's unique_id."""
return self.async_abort(reason="not_implemented") return self.async_abort(reason="not_implemented")
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initiated by the user.""" """Handle a flow initiated by the user."""
return self.async_abort(reason="not_implemented") return self.async_abort(reason="not_implemented")
@ -1245,7 +1245,7 @@ class ConfigFlow(data_entry_flow.FlowHandler):
async def async_step_discovery( async def async_step_discovery(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by discovery.""" """Handle a flow initialized by discovery."""
await self._async_handle_discovery_without_unique_id() await self._async_handle_discovery_without_unique_id()
return await self.async_step_user() return await self.async_step_user()
@ -1253,7 +1253,7 @@ class ConfigFlow(data_entry_flow.FlowHandler):
@callback @callback
def async_abort( def async_abort(
self, *, reason: str, description_placeholders: dict | None = None self, *, reason: str, description_placeholders: dict | None = None
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Abort the config flow.""" """Abort the config flow."""
# Remove reauth notification if no reauth flows are in progress # Remove reauth notification if no reauth flows are in progress
if self.source == SOURCE_REAUTH and not any( if self.source == SOURCE_REAUTH and not any(
@ -1271,37 +1271,37 @@ class ConfigFlow(data_entry_flow.FlowHandler):
async def async_step_hassio( async def async_step_hassio(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by HASS IO discovery.""" """Handle a flow initialized by HASS IO discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
async def async_step_homekit( async def async_step_homekit(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by Homekit discovery.""" """Handle a flow initialized by Homekit discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
async def async_step_mqtt( async def async_step_mqtt(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by MQTT discovery.""" """Handle a flow initialized by MQTT discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
async def async_step_ssdp( async def async_step_ssdp(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by SSDP discovery.""" """Handle a flow initialized by SSDP discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
async def async_step_zeroconf( async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by Zeroconf discovery.""" """Handle a flow initialized by Zeroconf discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
async def async_step_dhcp( async def async_step_dhcp(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by DHCP discovery.""" """Handle a flow initialized by DHCP discovery."""
return await self.async_step_discovery(discovery_info) return await self.async_step_discovery(discovery_info)
@ -1330,8 +1330,8 @@ class OptionsFlowManager(data_entry_flow.FlowManager):
return cast(OptionsFlow, HANDLERS[entry.domain].async_get_options_flow(entry)) return cast(OptionsFlow, HANDLERS[entry.domain].async_get_options_flow(entry))
async def async_finish_flow( async def async_finish_flow(
self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResultDict self, flow: data_entry_flow.FlowHandler, result: data_entry_flow.FlowResult
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Finish an options flow and update options for configuration entry. """Finish an options flow and update options for configuration entry.
Flow.handler and entry_id is the same thing to map flow with entry. Flow.handler and entry_id is the same thing to map flow with entry.

View file

@ -51,7 +51,7 @@ class AbortFlow(FlowError):
self.description_placeholders = description_placeholders self.description_placeholders = description_placeholders
class FlowResultDict(TypedDict, total=False): class FlowResult(TypedDict, total=False):
"""Typed result dict.""" """Typed result dict."""
version: int version: int
@ -112,17 +112,15 @@ class FlowManager(abc.ABC):
@abc.abstractmethod @abc.abstractmethod
async def async_finish_flow( async def async_finish_flow(
self, flow: FlowHandler, result: FlowResultDict self, flow: FlowHandler, result: FlowResult
) -> FlowResultDict: ) -> FlowResult:
"""Finish a config flow and add an entry.""" """Finish a config flow and add an entry."""
async def async_post_init(self, flow: FlowHandler, result: FlowResultDict) -> None: async def async_post_init(self, flow: FlowHandler, result: FlowResult) -> None:
"""Entry has finished executing its first step asynchronously.""" """Entry has finished executing its first step asynchronously."""
@callback @callback
def async_progress( def async_progress(self, include_uninitialized: bool = False) -> list[FlowResult]:
self, include_uninitialized: bool = False
) -> list[FlowResultDict]:
"""Return the flows in progress.""" """Return the flows in progress."""
return [ return [
{ {
@ -137,7 +135,7 @@ class FlowManager(abc.ABC):
async def async_init( async def async_init(
self, handler: str, *, context: dict[str, Any] | None = None, data: Any = None self, handler: str, *, context: dict[str, Any] | None = None, data: Any = None
) -> FlowResultDict: ) -> FlowResult:
"""Start a configuration flow.""" """Start a configuration flow."""
if context is None: if context is None:
context = {} context = {}
@ -165,7 +163,7 @@ class FlowManager(abc.ABC):
handler: str, handler: str,
context: dict, context: dict,
data: Any, data: Any,
) -> tuple[FlowHandler, FlowResultDict]: ) -> tuple[FlowHandler, FlowResult]:
"""Run the init in a task to allow it to be canceled at shutdown.""" """Run the init in a task to allow it to be canceled at shutdown."""
flow = await self.async_create_flow(handler, context=context, data=data) flow = await self.async_create_flow(handler, context=context, data=data)
if not flow: if not flow:
@ -186,7 +184,7 @@ class FlowManager(abc.ABC):
async def async_configure( async def async_configure(
self, flow_id: str, user_input: dict | None = None self, flow_id: str, user_input: dict | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Continue a configuration flow.""" """Continue a configuration flow."""
flow = self._progress.get(flow_id) flow = self._progress.get(flow_id)
@ -243,7 +241,7 @@ class FlowManager(abc.ABC):
step_id: str, step_id: str,
user_input: dict | None, user_input: dict | None,
step_done: asyncio.Future | None = None, step_done: asyncio.Future | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Handle a step of a flow.""" """Handle a step of a flow."""
method = f"async_step_{step_id}" method = f"async_step_{step_id}"
@ -256,7 +254,7 @@ class FlowManager(abc.ABC):
) )
try: try:
result: FlowResultDict = await getattr(flow, method)(user_input) result: FlowResult = await getattr(flow, method)(user_input)
except AbortFlow as err: except AbortFlow as err:
result = _create_abort_data( result = _create_abort_data(
flow.flow_id, flow.handler, err.reason, err.description_placeholders flow.flow_id, flow.handler, err.reason, err.description_placeholders
@ -347,7 +345,7 @@ class FlowHandler:
errors: dict[str, str] | None = None, errors: dict[str, str] | None = None,
description_placeholders: dict[str, Any] | None = None, description_placeholders: dict[str, Any] | None = None,
last_step: bool | None = None, last_step: bool | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Return the definition of a form to gather user input.""" """Return the definition of a form to gather user input."""
return { return {
"type": RESULT_TYPE_FORM, "type": RESULT_TYPE_FORM,
@ -368,7 +366,7 @@ class FlowHandler:
data: Mapping[str, Any], data: Mapping[str, Any],
description: str | None = None, description: str | None = None,
description_placeholders: dict | None = None, description_placeholders: dict | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Finish config flow and create a config entry.""" """Finish config flow and create a config entry."""
return { return {
"version": self.VERSION, "version": self.VERSION,
@ -384,7 +382,7 @@ class FlowHandler:
@callback @callback
def async_abort( def async_abort(
self, *, reason: str, description_placeholders: dict | None = None self, *, reason: str, description_placeholders: dict | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Abort the config flow.""" """Abort the config flow."""
return _create_abort_data( return _create_abort_data(
self.flow_id, self.handler, reason, description_placeholders self.flow_id, self.handler, reason, description_placeholders
@ -393,7 +391,7 @@ class FlowHandler:
@callback @callback
def async_external_step( def async_external_step(
self, *, step_id: str, url: str, description_placeholders: dict | None = None self, *, step_id: str, url: str, description_placeholders: dict | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Return the definition of an external step for the user to take.""" """Return the definition of an external step for the user to take."""
return { return {
"type": RESULT_TYPE_EXTERNAL_STEP, "type": RESULT_TYPE_EXTERNAL_STEP,
@ -405,7 +403,7 @@ class FlowHandler:
} }
@callback @callback
def async_external_step_done(self, *, next_step_id: str) -> FlowResultDict: def async_external_step_done(self, *, next_step_id: str) -> FlowResult:
"""Return the definition of an external step for the user to take.""" """Return the definition of an external step for the user to take."""
return { return {
"type": RESULT_TYPE_EXTERNAL_STEP_DONE, "type": RESULT_TYPE_EXTERNAL_STEP_DONE,
@ -421,7 +419,7 @@ class FlowHandler:
step_id: str, step_id: str,
progress_action: str, progress_action: str,
description_placeholders: dict | None = None, description_placeholders: dict | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Show a progress message to the user, without user input allowed.""" """Show a progress message to the user, without user input allowed."""
return { return {
"type": RESULT_TYPE_SHOW_PROGRESS, "type": RESULT_TYPE_SHOW_PROGRESS,
@ -433,7 +431,7 @@ class FlowHandler:
} }
@callback @callback
def async_show_progress_done(self, *, next_step_id: str) -> FlowResultDict: def async_show_progress_done(self, *, next_step_id: str) -> FlowResult:
"""Mark the progress done.""" """Mark the progress done."""
return { return {
"type": RESULT_TYPE_SHOW_PROGRESS_DONE, "type": RESULT_TYPE_SHOW_PROGRESS_DONE,
@ -449,7 +447,7 @@ def _create_abort_data(
handler: str, handler: str,
reason: str, reason: str,
description_placeholders: dict | None = None, description_placeholders: dict | None = None,
) -> FlowResultDict: ) -> FlowResult:
"""Return the definition of an external step for the user to take.""" """Return the definition of an external step for the user to take."""
return { return {
"type": RESULT_TYPE_ABORT, "type": RESULT_TYPE_ABORT,

View file

@ -5,7 +5,7 @@ from typing import Any, Awaitable, Callable, Union
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.typing import DiscoveryInfoType from homeassistant.helpers.typing import DiscoveryInfoType
DiscoveryFunctionType = Callable[[], Union[Awaitable[bool], bool]] DiscoveryFunctionType = Callable[[], Union[Awaitable[bool], bool]]
@ -31,7 +31,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")
@ -42,7 +42,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow):
async def async_step_confirm( async def async_step_confirm(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Confirm setup.""" """Confirm setup."""
if user_input is None: if user_input is None:
self._set_confirm_only() self._set_confirm_only()
@ -72,7 +72,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow):
async def async_step_discovery( async def async_step_discovery(
self, discovery_info: DiscoveryInfoType self, discovery_info: DiscoveryInfoType
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow initialized by discovery.""" """Handle a flow initialized by discovery."""
if self._async_in_progress() or self._async_current_entries(): if self._async_in_progress() or self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")
@ -87,7 +87,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow):
async_step_homekit = async_step_discovery async_step_homekit = async_step_discovery
async_step_dhcp = async_step_discovery async_step_dhcp = async_step_discovery
async def async_step_import(self, _: dict[str, Any] | None) -> FlowResultDict: async def async_step_import(self, _: dict[str, Any] | None) -> FlowResult:
"""Handle a flow initialized by import.""" """Handle a flow initialized by import."""
if self._async_current_entries(): if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")
@ -137,7 +137,7 @@ class WebhookFlowHandler(config_entries.ConfigFlow):
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a user initiated set up flow to create a webhook.""" """Handle a user initiated set up flow to create a webhook."""
if not self._allow_multiple and self._async_current_entries(): if not self._allow_multiple and self._async_current_entries():
return self.async_abort(reason="single_instance_allowed") return self.async_abort(reason="single_instance_allowed")

View file

@ -24,7 +24,7 @@ from yarl import URL
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components import http from homeassistant.components import http
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResultDict from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.network import NoURLAvailableError from homeassistant.helpers.network import NoURLAvailableError
from .aiohttp_client import async_get_clientsession from .aiohttp_client import async_get_clientsession
@ -236,7 +236,7 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
async def async_step_pick_implementation( async def async_step_pick_implementation(
self, user_input: dict | None = None self, user_input: dict | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Handle a flow start.""" """Handle a flow start."""
implementations = await async_get_implementations(self.hass, self.DOMAIN) implementations = await async_get_implementations(self.hass, self.DOMAIN)
@ -267,7 +267,7 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
async def async_step_auth( async def async_step_auth(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Create an entry for auth.""" """Create an entry for auth."""
# Flow has been triggered by external data # Flow has been triggered by external data
if user_input: if user_input:
@ -293,7 +293,7 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
async def async_step_creation( async def async_step_creation(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> FlowResultDict: ) -> FlowResult:
"""Create config entry from external data.""" """Create config entry from external data."""
token = await self.flow_impl.async_resolve_external_data(self.external_data) token = await self.flow_impl.async_resolve_external_data(self.external_data)
# Force int for non-compliant oauth2 providers # Force int for non-compliant oauth2 providers
@ -310,7 +310,7 @@ class AbstractOAuth2FlowHandler(config_entries.ConfigFlow, metaclass=ABCMeta):
{"auth_implementation": self.flow_impl.domain, "token": token} {"auth_implementation": self.flow_impl.domain, "token": token}
) )
async def async_oauth_create_entry(self, data: dict) -> FlowResultDict: async def async_oauth_create_entry(self, data: dict) -> FlowResult:
"""Create an entry for the flow. """Create an entry for the flow.
Ok to override if you want to fetch extra info or even add another step. Ok to override if you want to fetch extra info or even add another step.

View file

@ -22,8 +22,8 @@ class _BaseFlowManagerView(HomeAssistantView):
# pylint: disable=no-self-use # pylint: disable=no-self-use
def _prepare_result_json( def _prepare_result_json(
self, result: data_entry_flow.FlowResultDict self, result: data_entry_flow.FlowResult
) -> data_entry_flow.FlowResultDict: ) -> data_entry_flow.FlowResult:
"""Convert result to JSON.""" """Convert result to JSON."""
if result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY: if result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY:
data = result.copy() data = result.copy()