mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Use Mapping for async_step_reauth (p-s) (#72766)
This commit is contained in:
parent
52561ce076
commit
fc8727454a
@ -1,6 +1,7 @@
|
||||
"""Config flow for Tesla Powerwall integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -205,7 +206,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: dict[str, str]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow to configure the PVOutput integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from pvo import PVOutput, PVOutputAuthenticationError, PVOutputError
|
||||
@ -83,7 +84,7 @@ class PVOutputFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle initiation of re-authentication with PVOutput."""
|
||||
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow to configure Renault component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from renault_api.const import AVAILABLE_LOCALES
|
||||
@ -21,7 +22,7 @@ class RenaultFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the Renault config flow."""
|
||||
self._original_data: dict[str, Any] | None = None
|
||||
self._original_data: Mapping[str, Any] | None = None
|
||||
self.renault_config: dict[str, Any] = {}
|
||||
self.renault_hub: RenaultHub | None = None
|
||||
|
||||
@ -92,9 +93,9 @@ class RenaultFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
),
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, user_input: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self._original_data = user_input.copy()
|
||||
self._original_data = data
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow for Ridwell integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from aioridwell import async_get_client
|
||||
@ -80,7 +81,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
data={CONF_USERNAME: self._username, CONF_PASSWORD: self._password},
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, config: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
@ -1,9 +1,9 @@
|
||||
"""Config flow for Samsung TV."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from functools import partial
|
||||
import socket
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@ -525,7 +525,7 @@ class SamsungTVConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
|
||||
async def async_step_reauth(
|
||||
self, data: MappingProxyType[str, Any]
|
||||
self, data: Mapping[str, Any]
|
||||
) -> data_entry_flow.FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Adds config flow for Sensibo integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from pysensibo.exceptions import AuthenticationError
|
||||
@ -28,9 +29,7 @@ class SensiboConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
entry: config_entries.ConfigEntry | None
|
||||
|
||||
async def async_step_reauth(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle re-authentication with Sensibo."""
|
||||
|
||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
|
@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
@ -97,7 +98,7 @@ class SimpliSafeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Define the config flow to handle options."""
|
||||
return SimpliSafeOptionsFlowHandler(config_entry)
|
||||
|
||||
async def async_step_reauth(self, config: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._reauth = True
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow to configure SleepIQ component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -79,12 +80,12 @@ class SleepIQFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
last_step=True,
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, user_input: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||
self.context["entry_id"]
|
||||
)
|
||||
return await self.async_step_reauth_confirm(user_input)
|
||||
return await self.async_step_reauth_confirm(dict(data))
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow for Steam integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
import steam
|
||||
@ -125,7 +126,7 @@ class SteamFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
import_config[CONF_ACCOUNT] = import_config[CONF_ACCOUNTS][0]
|
||||
return await self.async_step_user(import_config)
|
||||
|
||||
async def async_step_reauth(self, user_input: dict[str, str]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle a reauthorization flow request."""
|
||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow for Sure Petcare integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -86,7 +87,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
step_id="user", data_schema=USER_DATA_SCHEMA, errors=errors
|
||||
)
|
||||
|
||||
async def async_step_reauth(self, config: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle configuration by re-auth."""
|
||||
self._username = config[CONF_USERNAME]
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Config flow to configure the Synology DSM integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from ipaddress import ip_address
|
||||
import logging
|
||||
from typing import Any
|
||||
@ -120,7 +121,7 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Initialize the synology_dsm config flow."""
|
||||
self.saved_user_input: dict[str, Any] = {}
|
||||
self.discovered_conf: dict[str, Any] = {}
|
||||
self.reauth_conf: dict[str, Any] = {}
|
||||
self.reauth_conf: Mapping[str, Any] = {}
|
||||
self.reauth_reason: str | None = None
|
||||
|
||||
def _show_form(
|
||||
@ -299,9 +300,9 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
user_input = {**self.discovered_conf, **user_input}
|
||||
return await self.async_validate_input_create_entry(user_input, step_id=step)
|
||||
|
||||
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self.reauth_conf = data.copy()
|
||||
self.reauth_conf = data
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
|
@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -202,7 +203,7 @@ class ConfigFlow(
|
||||
|
||||
return await self.async_step_authenticate()
|
||||
|
||||
async def async_step_reauth(self, entry_data: dict[str, Any]) -> FlowResult:
|
||||
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Perform reauth upon an API authentication error."""
|
||||
self._name = entry_data[CONF_HOST]
|
||||
self._input = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user