Use Mapping for async_step_reauth (t-z) (#72767)

* Adjust tailscale

* Adjust tautulli

* Adjust tile

* Adjust tractive

* Adjust trafikverket_ferry

* Adjust trafikverket_train

* Adjust unifiprotect

* Adjust uptimerobot

* Adjust verisure

* Adjust vlc_telnet

* Adjust wallbox

* Adjust watttime

* Adjust yale_smart_alarm
This commit is contained in:
epenet 2022-05-31 22:44:06 +02:00 committed by GitHub
parent 84779482b8
commit 9cea936c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 23 deletions

View File

@ -1,6 +1,7 @@
"""Config flow to configure the Tailscale integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from tailscale import Tailscale, TailscaleAuthenticationError, TailscaleError
@ -81,7 +82,7 @@ class TailscaleFlowHandler(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 Tailscale."""
self.reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]

View File

@ -1,6 +1,7 @@
"""Config flow for Tautulli."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pytautulli import (
@ -70,7 +71,7 @@ class TautulliConfigFlow(ConfigFlow, domain=DOMAIN):
errors=errors or {},
)
async def async_step_reauth(self, config: dict[str, Any]) -> FlowResult:
async def async_step_reauth(self, config: Mapping[str, Any]) -> FlowResult:
"""Handle a reauthorization flow request."""
return await self.async_step_reauth_confirm()

View File

@ -1,6 +1,7 @@
"""Config flow to configure the Tile integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pytile import async_login
@ -74,7 +75,7 @@ class TileFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Import a config entry from configuration.yaml."""
return await self.async_step_user(import_config)
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()

View File

@ -1,6 +1,7 @@
"""Config flow for tractive integration."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
@ -69,7 +70,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=USER_DATA_SCHEMA, errors=errors
)
async def async_step_reauth(self, _: dict[str, Any]) -> FlowResult:
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
"""Handle configuration by re-auth."""
return await self.async_step_reauth_confirm()

View File

@ -1,6 +1,7 @@
"""Adds config flow for Trafikverket Ferry integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pytrafikverket import TrafikverketFerry
@ -59,9 +60,7 @@ class TVFerryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
ferry_api = TrafikverketFerry(web_session, api_key)
await ferry_api.async_get_next_ferry_stop(ferry_from, ferry_to)
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 Trafikverket."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])

View File

@ -1,6 +1,7 @@
"""Adds config flow for Trafikverket Train integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pytrafikverket import TrafikverketTrain
@ -54,9 +55,7 @@ class TVTrainConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await train_api.async_get_train_station(train_from)
await train_api.async_get_train_station(train_to)
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 Trafikverket."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])

View File

@ -1,6 +1,7 @@
"""Config Flow to configure UniFi Protect Integration."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
@ -236,7 +237,7 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return nvr_data, errors
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.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])

View File

@ -1,6 +1,7 @@
"""Config flow for UptimeRobot integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from pyuptimerobot import (
@ -84,9 +85,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
)
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:
"""Return the reauth confirm step."""
return await self.async_step_reauth_confirm()

View File

@ -1,6 +1,7 @@
"""Config flow for Verisure integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any, cast
from verisure import (
@ -108,7 +109,7 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
},
)
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 Verisure."""
self.entry = cast(
ConfigEntry,

View File

@ -1,6 +1,7 @@
"""Config flow for VLC media player Telnet integration."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
@ -104,7 +105,7 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN):
step_id="user", data_schema=user_form_schema(user_input), 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 reauth flow."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
assert self.entry

View File

@ -1,6 +1,7 @@
"""Config flow for Wallbox integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
import voluptuous as vol
@ -47,9 +48,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=COMPONENT_DOMAIN):
"""Start the Wallbox config flow."""
self._reauth_entry: config_entries.ConfigEntry | None = 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:
"""Perform reauth upon an API authentication error."""
self._reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]

View File

@ -1,6 +1,7 @@
"""Config flow for WattTime integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any
from aiowatttime import Client
@ -189,7 +190,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
return await self.async_step_coordinates()
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._data = {**config}
return await self.async_step_reauth_confirm()

View File

@ -1,6 +1,7 @@
"""Adds config flow for Yale Smart Alarm integration."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
import voluptuous as vol
@ -53,9 +54,7 @@ class YaleConfigFlow(ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler."""
return YaleOptionsFlowHandler(config_entry)
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 initiation of re-authentication with Yale."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
return await self.async_step_reauth_confirm()