Use Mapping for async_step_reauth (f-o) (#72764)
This commit is contained in:
parent
14f47c7450
commit
756988fe20
10 changed files with 23 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow to configure the FRITZ!Box Tools integration."""
|
"""Config flow to configure the FRITZ!Box Tools integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
@ -230,7 +231,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
return self._async_create_entry()
|
return self._async_create_entry()
|
||||||
|
|
||||||
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResult:
|
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle flow upon an API authentication error."""
|
"""Handle flow upon an API authentication error."""
|
||||||
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"])
|
||||||
self._host = data[CONF_HOST]
|
self._host = data[CONF_HOST]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for AVM FRITZ!SmartHome."""
|
"""Config flow for AVM FRITZ!SmartHome."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import ipaddress
|
import ipaddress
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -175,7 +176,7 @@ class FritzboxConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, data: dict[str, str]) -> FlowResult:
|
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Trigger a reauthentication flow."""
|
"""Trigger a reauthentication flow."""
|
||||||
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||||
assert entry is not None
|
assert entry is not None
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from collections.abc import Mapping
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -142,7 +143,7 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self,
|
self,
|
||||||
config_data: dict[str, Any],
|
config_data: Mapping[str, Any],
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a reauthentication flow."""
|
"""Handle a reauthentication flow."""
|
||||||
self._data = dict(config_data)
|
self._data = dict(config_data)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for Universal Devices ISY994 integration."""
|
"""Config flow for Universal Devices ISY994 integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from urllib.parse import urlparse, urlunparse
|
from urllib.parse import urlparse, urlunparse
|
||||||
|
@ -254,7 +255,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, data: Mapping[str, Any]
|
||||||
) -> data_entry_flow.FlowResult:
|
) -> data_entry_flow.FlowResult:
|
||||||
"""Handle reauth."""
|
"""Handle reauth."""
|
||||||
self._existing_entry = await self.async_set_unique_id(self.context["unique_id"])
|
self._existing_entry = await self.async_set_unique_id(self.context["unique_id"])
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for laundrify integration."""
|
"""Config flow for laundrify integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -76,9 +77,7 @@ class LaundrifyConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
step_id="init", data_schema=CONFIG_SCHEMA, errors=errors
|
step_id="init", data_schema=CONFIG_SCHEMA, errors=errors
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||||
self, user_input: dict[str, Any] | None = None
|
|
||||||
) -> FlowResult:
|
|
||||||
"""Perform reauth upon an API authentication error."""
|
"""Perform reauth upon an API authentication error."""
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
"""Config flow for Meater."""
|
"""Config flow for Meater."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from meater import AuthenticationError, MeaterApi, ServiceUnavailableError
|
from meater import AuthenticationError, MeaterApi, ServiceUnavailableError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@ class MeaterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
return await self._try_connect_meater("user", None, username, password)
|
return await self._try_connect_meater("user", None, username, password)
|
||||||
|
|
||||||
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."""
|
"""Handle configuration by re-auth."""
|
||||||
self._data_schema = REAUTH_SCHEMA
|
self._data_schema = REAUTH_SCHEMA
|
||||||
self._username = data[CONF_USERNAME]
|
self._username = data[CONF_USERNAME]
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ class NAMFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
errors=errors,
|
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 configuration by re-auth."""
|
"""Handle configuration by re-auth."""
|
||||||
if entry := self.hass.config_entries.async_get_entry(self.context["entry_id"]):
|
if entry := self.hass.config_entries.async_get_entry(self.context["entry_id"]):
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for Nanoleaf integration."""
|
"""Config flow for Nanoleaf integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Any, Final, cast
|
from typing import Any, Final, cast
|
||||||
|
@ -77,7 +78,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
)
|
)
|
||||||
return await self.async_step_link()
|
return await self.async_step_link()
|
||||||
|
|
||||||
async def async_step_reauth(self, data: dict[str, str]) -> FlowResult:
|
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle Nanoleaf reauth flow if token is invalid."""
|
"""Handle Nanoleaf reauth flow if token is invalid."""
|
||||||
self.reauth_entry = cast(
|
self.reauth_entry = cast(
|
||||||
config_entries.ConfigEntry,
|
config_entries.ConfigEntry,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow to configure the Notion integration."""
|
"""Config flow to configure the Notion integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from aionotion import async_get_client
|
from aionotion import async_get_client
|
||||||
|
@ -73,7 +74,7 @@ class NotionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
return self.async_create_entry(title=self._username, data=data)
|
return self.async_create_entry(title=self._username, data=data)
|
||||||
|
|
||||||
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."""
|
"""Handle configuration by re-auth."""
|
||||||
self._username = config[CONF_USERNAME]
|
self._username = config[CONF_USERNAME]
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for Overkiz (by Somfy) integration."""
|
"""Config flow for Overkiz (by Somfy) integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
|
@ -154,9 +155,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||||
self, user_input: dict[str, Any] | None = None
|
|
||||||
) -> FlowResult:
|
|
||||||
"""Handle reauth."""
|
"""Handle reauth."""
|
||||||
self._config_entry = cast(
|
self._config_entry = cast(
|
||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
|
@ -170,4 +169,4 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self._default_user = self._config_entry.data[CONF_USERNAME]
|
self._default_user = self._config_entry.data[CONF_USERNAME]
|
||||||
self._default_hub = self._config_entry.data[CONF_HUB]
|
self._default_hub = self._config_entry.data[CONF_HUB]
|
||||||
|
|
||||||
return await self.async_step_user(user_input)
|
return await self.async_step_user(dict(data))
|
||||||
|
|
Loading…
Add table
Reference in a new issue