Add type hints to async_step_reauth in components (#74138)
This commit is contained in:
parent
6dc6e71f01
commit
edc1ee2985
9 changed files with 37 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
||||||
"""Config flow for Bosch Smart Home Controller integration."""
|
"""Config flow for Bosch Smart Home Controller integration."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from os import makedirs
|
from os import makedirs
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from boschshcpy import SHCRegisterClient, SHCSession
|
from boschshcpy import SHCRegisterClient, SHCSession
|
||||||
from boschshcpy.exceptions import (
|
from boschshcpy.exceptions import (
|
||||||
|
@ -83,7 +85,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
host = None
|
host = None
|
||||||
hostname = None
|
hostname = None
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> 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,7 @@
|
||||||
"""Config flow for Enphase Envoy integration."""
|
"""Config flow for Enphase Envoy integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import contextlib
|
import contextlib
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -110,7 +111,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(self, user_input):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle configuration by re-auth."""
|
"""Handle configuration by re-auth."""
|
||||||
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
self._reauth_entry = self.hass.config_entries.async_get_entry(
|
||||||
self.context["entry_id"]
|
self.context["entry_id"]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
"""Config flow for flume integration."""
|
"""Config flow for flume integration."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from pyflume import FlumeAuth, FlumeDeviceList
|
from pyflume import FlumeAuth, FlumeDeviceList
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
|
@ -13,6 +15,7 @@ from homeassistant.const import (
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
|
||||||
from .const import BASE_TOKEN_FILENAME, DOMAIN
|
from .const import BASE_TOKEN_FILENAME, DOMAIN
|
||||||
|
|
||||||
|
@ -103,7 +106,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle reauth."""
|
"""Handle reauth."""
|
||||||
self._reauth_unique_id = self.context["unique_id"]
|
self._reauth_unique_id = self.context["unique_id"]
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Config flow for IntelliFire integration."""
|
"""Config flow for IntelliFire integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -220,10 +221,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
LOGGER.debug("Running Step: manual_device_entry")
|
LOGGER.debug("Running Step: manual_device_entry")
|
||||||
return await self.async_step_manual_device_entry()
|
return await self.async_step_manual_device_entry()
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Perform reauth upon an API authentication error."""
|
"""Perform reauth upon an API authentication error."""
|
||||||
LOGGER.debug("STEP: reauth")
|
LOGGER.debug("STEP: reauth")
|
||||||
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
|
||||||
|
assert entry.unique_id
|
||||||
|
|
||||||
# populate the expected vars
|
# populate the expected vars
|
||||||
self._serial = entry.unique_id
|
self._serial = entry.unique_id
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
"""Config flow for Honeywell Lyric."""
|
"""Config flow for Honeywell Lyric."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
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
|
from .const import DOMAIN
|
||||||
|
@ -18,7 +21,7 @@ class OAuth2FlowHandler(
|
||||||
"""Return logger."""
|
"""Return logger."""
|
||||||
return logging.getLogger(__name__)
|
return logging.getLogger(__name__)
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> 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,5 +1,7 @@
|
||||||
"""Config flow for MyQ integration."""
|
"""Config flow for MyQ integration."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import pymyq
|
import pymyq
|
||||||
from pymyq.errors import InvalidCredentialsError, MyQError
|
from pymyq.errors import InvalidCredentialsError, MyQError
|
||||||
|
@ -7,6 +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 FlowResult
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -60,7 +63,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle reauth."""
|
"""Handle reauth."""
|
||||||
self._reauth_unique_id = self.context["unique_id"]
|
self._reauth_unique_id = self.context["unique_id"]
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
"""Config flow for Picnic integration."""
|
"""Config flow for Picnic integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from python_picnic_api import PicnicAPI
|
from python_picnic_api import PicnicAPI
|
||||||
from python_picnic_api.session import PicnicAuthError
|
from python_picnic_api.session import PicnicAuthError
|
||||||
|
@ -11,6 +13,7 @@ import voluptuous as vol
|
||||||
from homeassistant import config_entries, core, exceptions
|
from homeassistant import config_entries, core, exceptions
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH
|
from homeassistant.config_entries import SOURCE_REAUTH
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_PASSWORD, CONF_USERNAME
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
|
||||||
from .const import CONF_COUNTRY_CODE, COUNTRY_CODES, DOMAIN
|
from .const import CONF_COUNTRY_CODE, COUNTRY_CODES, DOMAIN
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_reauth(self, _):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Perform the re-auth step upon an API authentication error."""
|
"""Perform the re-auth step upon an API authentication error."""
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Config flow for Prosegur Alarm integration."""
|
"""Config flow for Prosegur Alarm integration."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any, cast
|
||||||
|
|
||||||
from pyprosegur.auth import COUNTRY, Auth
|
from pyprosegur.auth import COUNTRY, Auth
|
||||||
from pyprosegur.installation import Installation
|
from pyprosegur.installation import Installation
|
||||||
|
@ -8,6 +10,7 @@ import voluptuous as vol
|
||||||
from homeassistant import config_entries, core, exceptions
|
from homeassistant import config_entries, core, exceptions
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
|
||||||
from .const import CONF_COUNTRY, DOMAIN
|
from .const import CONF_COUNTRY, DOMAIN
|
||||||
|
@ -75,9 +78,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, data):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Handle initiation of re-authentication with Prosegur."""
|
"""Handle initiation of re-authentication with Prosegur."""
|
||||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
self.entry = cast(
|
||||||
|
ConfigEntry,
|
||||||
|
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(self, user_input=None):
|
async def async_step_reauth_confirm(self, user_input=None):
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Adds config flow for Vulcan."""
|
"""Adds config flow for Vulcan."""
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp import ClientConnectionError
|
from aiohttp import ClientConnectionError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -16,6 +18,7 @@ from vulcan import (
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_PIN, CONF_REGION, CONF_TOKEN
|
from homeassistant.const import CONF_PIN, CONF_REGION, CONF_TOKEN
|
||||||
|
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 . import DOMAIN
|
from . import DOMAIN
|
||||||
|
@ -236,7 +239,7 @@ class VulcanFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, user_input=None):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> 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()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue