From 42ed0fd47bd6f10e0a47eb12e764501d4d2e5706 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 13 Jun 2022 13:30:41 +0200 Subject: [PATCH] Add async_get_options_flow type hints (n-z) (#73431) --- homeassistant/components/omnilogic/config_flow.py | 8 ++++++-- homeassistant/components/onvif/config_flow.py | 6 ++++-- homeassistant/components/opentherm_gw/config_flow.py | 8 ++++++-- homeassistant/components/openweathermap/config_flow.py | 8 ++++++-- homeassistant/components/plaato/config_flow.py | 4 +++- homeassistant/components/plex/config_flow.py | 8 ++++++-- .../components/pvpc_hourly_pricing/config_flow.py | 8 ++++++-- homeassistant/components/rachio/config_flow.py | 6 +++++- homeassistant/components/risco/config_flow.py | 8 ++++++-- homeassistant/components/roomba/config_flow.py | 7 +++++-- homeassistant/components/screenlogic/config_flow.py | 6 +++++- homeassistant/components/sia/config_flow.py | 6 ++++-- homeassistant/components/somfy_mylink/config_flow.py | 6 +++++- homeassistant/components/subaru/config_flow.py | 6 +++++- homeassistant/components/tado/config_flow.py | 6 +++++- homeassistant/components/totalconnect/config_flow.py | 8 ++++++-- homeassistant/components/transmission/config_flow.py | 8 ++++++-- homeassistant/components/wiffi/config_flow.py | 8 ++++++-- homeassistant/components/ws66i/config_flow.py | 8 ++++++-- homeassistant/components/yeelight/config_flow.py | 8 +++++--- 20 files changed, 106 insertions(+), 35 deletions(-) diff --git a/homeassistant/components/omnilogic/config_flow.py b/homeassistant/components/omnilogic/config_flow.py index d5239760fcc..1635eaa7558 100644 --- a/homeassistant/components/omnilogic/config_flow.py +++ b/homeassistant/components/omnilogic/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Omnilogic integration.""" +from __future__ import annotations + import logging from omnilogic import LoginException, OmniLogic, OmniLogicException @@ -21,7 +23,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) @@ -71,7 +75,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Handle Omnilogic client options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/onvif/config_flow.py b/homeassistant/components/onvif/config_flow.py index 1ee0be18467..d7fb46079d9 100644 --- a/homeassistant/components/onvif/config_flow.py +++ b/homeassistant/components/onvif/config_flow.py @@ -76,7 +76,9 @@ class OnvifFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OnvifOptionsFlowHandler: """Get the options flow for this handler.""" return OnvifOptionsFlowHandler(config_entry) @@ -262,7 +264,7 @@ class OnvifFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class OnvifOptionsFlowHandler(config_entries.OptionsFlow): """Handle ONVIF options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize ONVIF options flow.""" self.config_entry = config_entry self.options = dict(config_entry.options) diff --git a/homeassistant/components/opentherm_gw/config_flow.py b/homeassistant/components/opentherm_gw/config_flow.py index 7c3bc8f8f6b..1d66d6e2069 100644 --- a/homeassistant/components/opentherm_gw/config_flow.py +++ b/homeassistant/components/opentherm_gw/config_flow.py @@ -1,4 +1,6 @@ """OpenTherm Gateway config flow.""" +from __future__ import annotations + import asyncio import pyotgw @@ -34,7 +36,9 @@ class OpenThermGwConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OpenThermGwOptionsFlow: """Get the options flow for this handler.""" return OpenThermGwOptionsFlow(config_entry) @@ -111,7 +115,7 @@ class OpenThermGwConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OpenThermGwOptionsFlow(config_entries.OptionsFlow): """Handle opentherm_gw options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize the options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/openweathermap/config_flow.py b/homeassistant/components/openweathermap/config_flow.py index 0b7a3a1a25f..612965bdb2f 100644 --- a/homeassistant/components/openweathermap/config_flow.py +++ b/homeassistant/components/openweathermap/config_flow.py @@ -1,4 +1,6 @@ """Config flow for OpenWeatherMap.""" +from __future__ import annotations + from pyowm import OWM from pyowm.commons.exceptions import APIRequestError, UnauthorizedError import voluptuous as vol @@ -33,7 +35,9 @@ class OpenWeatherMapConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OpenWeatherMapOptionsFlow: """Get the options flow for this handler.""" return OpenWeatherMapOptionsFlow(config_entry) @@ -89,7 +93,7 @@ class OpenWeatherMapConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OpenWeatherMapOptionsFlow(config_entries.OptionsFlow): """Handle options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/plaato/config_flow.py b/homeassistant/components/plaato/config_flow.py index dc9533c4be2..637122b1d9c 100644 --- a/homeassistant/components/plaato/config_flow.py +++ b/homeassistant/components/plaato/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Plaato.""" +from __future__ import annotations + from pyplaato.plaato import PlaatoDeviceType import voluptuous as vol @@ -161,7 +163,7 @@ class PlaatoConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow(config_entry: ConfigEntry) -> PlaatoOptionsFlowHandler: """Get the options flow for this handler.""" return PlaatoOptionsFlowHandler(config_entry) diff --git a/homeassistant/components/plex/config_flow.py b/homeassistant/components/plex/config_flow.py index 8da67dafc3d..3489e41364e 100644 --- a/homeassistant/components/plex/config_flow.py +++ b/homeassistant/components/plex/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Plex.""" +from __future__ import annotations + import copy import logging @@ -85,7 +87,9 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> PlexOptionsFlowHandler: """Get the options flow for this handler.""" return PlexOptionsFlowHandler(config_entry) @@ -334,7 +338,7 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class PlexOptionsFlowHandler(config_entries.OptionsFlow): """Handle Plex options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize Plex options flow.""" self.options = copy.deepcopy(dict(config_entry.options)) self.server_id = config_entry.data[CONF_SERVER_IDENTIFIER] diff --git a/homeassistant/components/pvpc_hourly_pricing/config_flow.py b/homeassistant/components/pvpc_hourly_pricing/config_flow.py index 76694d570b5..f5aeb951d33 100644 --- a/homeassistant/components/pvpc_hourly_pricing/config_flow.py +++ b/homeassistant/components/pvpc_hourly_pricing/config_flow.py @@ -1,4 +1,6 @@ """Config flow for pvpc_hourly_pricing.""" +from __future__ import annotations + import voluptuous as vol from homeassistant import config_entries @@ -15,7 +17,9 @@ class TariffSelectorConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> PVPCOptionsFlowHandler: """Get the options flow for this handler.""" return PVPCOptionsFlowHandler(config_entry) @@ -36,7 +40,7 @@ class TariffSelectorConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class PVPCOptionsFlowHandler(config_entries.OptionsFlow): """Handle PVPC options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/rachio/config_flow.py b/homeassistant/components/rachio/config_flow.py index 9e93dba065e..00f31003ba6 100644 --- a/homeassistant/components/rachio/config_flow.py +++ b/homeassistant/components/rachio/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Rachio integration.""" +from __future__ import annotations + from http import HTTPStatus import logging @@ -92,7 +94,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) diff --git a/homeassistant/components/risco/config_flow.py b/homeassistant/components/risco/config_flow.py index c20aa2af287..e2e139a19e0 100644 --- a/homeassistant/components/risco/config_flow.py +++ b/homeassistant/components/risco/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Risco integration.""" +from __future__ import annotations + import logging from pyrisco import CannotConnectError, RiscoAPI, UnauthorizedError @@ -67,7 +69,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @core.callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> RiscoOptionsFlowHandler: """Define the config flow to handle options.""" return RiscoOptionsFlowHandler(config_entry) @@ -98,7 +102,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class RiscoOptionsFlowHandler(config_entries.OptionsFlow): """Handle a Risco options flow.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize.""" self.config_entry = config_entry self._data = {**DEFAULT_OPTIONS, **config_entry.options} diff --git a/homeassistant/components/roomba/config_flow.py b/homeassistant/components/roomba/config_flow.py index 7aee875308b..0a1c51ca38c 100644 --- a/homeassistant/components/roomba/config_flow.py +++ b/homeassistant/components/roomba/config_flow.py @@ -1,4 +1,5 @@ """Config flow to configure roomba component.""" +from __future__ import annotations import asyncio from functools import partial @@ -78,7 +79,9 @@ class RoombaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) @@ -267,7 +270,7 @@ class RoombaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Handle options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/screenlogic/config_flow.py b/homeassistant/components/screenlogic/config_flow.py index 1aeedfb421d..2b845d453df 100644 --- a/homeassistant/components/screenlogic/config_flow.py +++ b/homeassistant/components/screenlogic/config_flow.py @@ -1,4 +1,6 @@ """Config flow for ScreenLogic.""" +from __future__ import annotations + import logging from screenlogicpy import ScreenLogicError, discovery @@ -69,7 +71,9 @@ class ScreenlogicConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> ScreenLogicOptionsFlowHandler: """Get the options flow for ScreenLogic.""" return ScreenLogicOptionsFlowHandler(config_entry) diff --git a/homeassistant/components/sia/config_flow.py b/homeassistant/components/sia/config_flow.py index a2f7bc744e3..df03882e995 100644 --- a/homeassistant/components/sia/config_flow.py +++ b/homeassistant/components/sia/config_flow.py @@ -94,7 +94,9 @@ class SIAConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> SIAOptionsFlowHandler: """Get the options flow for this handler.""" return SIAOptionsFlowHandler(config_entry) @@ -170,7 +172,7 @@ class SIAConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class SIAOptionsFlowHandler(config_entries.OptionsFlow): """Handle SIA options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize SIA options flow.""" self.config_entry = config_entry self.options = deepcopy(dict(config_entry.options)) diff --git a/homeassistant/components/somfy_mylink/config_flow.py b/homeassistant/components/somfy_mylink/config_flow.py index 768d12da45b..de38ac271ce 100644 --- a/homeassistant/components/somfy_mylink/config_flow.py +++ b/homeassistant/components/somfy_mylink/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Somfy MyLink integration.""" +from __future__ import annotations + import asyncio from copy import deepcopy import logging @@ -110,7 +112,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) diff --git a/homeassistant/components/subaru/config_flow.py b/homeassistant/components/subaru/config_flow.py index 788b6f04fd5..79c412c8f85 100644 --- a/homeassistant/components/subaru/config_flow.py +++ b/homeassistant/components/subaru/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Subaru integration.""" +from __future__ import annotations + from datetime import datetime import logging @@ -83,7 +85,9 @@ class SubaruConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) diff --git a/homeassistant/components/tado/config_flow.py b/homeassistant/components/tado/config_flow.py index a03b370d0a3..ec195573203 100644 --- a/homeassistant/components/tado/config_flow.py +++ b/homeassistant/components/tado/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Tado integration.""" +from __future__ import annotations + import logging from PyTado.interface import Tado @@ -112,7 +114,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry) diff --git a/homeassistant/components/totalconnect/config_flow.py b/homeassistant/components/totalconnect/config_flow.py index 49e60b5b46e..057328cffb0 100644 --- a/homeassistant/components/totalconnect/config_flow.py +++ b/homeassistant/components/totalconnect/config_flow.py @@ -1,4 +1,6 @@ """Config flow for the Total Connect component.""" +from __future__ import annotations + from total_connect_client.client import TotalConnectClient from total_connect_client.exceptions import AuthenticationError import voluptuous as vol @@ -166,7 +168,9 @@ class TotalConnectConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> TotalConnectOptionsFlowHandler: """Get options flow.""" return TotalConnectOptionsFlowHandler(config_entry) @@ -174,7 +178,7 @@ class TotalConnectConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class TotalConnectOptionsFlowHandler(config_entries.OptionsFlow): """TotalConnect options flow handler.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/transmission/config_flow.py b/homeassistant/components/transmission/config_flow.py index ce62475b2eb..b57279ebbbb 100644 --- a/homeassistant/components/transmission/config_flow.py +++ b/homeassistant/components/transmission/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Transmission Bittorent Client.""" +from __future__ import annotations + import voluptuous as vol from homeassistant import config_entries @@ -44,7 +46,9 @@ class TransmissionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> TransmissionOptionsFlowHandler: """Get the options flow for this handler.""" return TransmissionOptionsFlowHandler(config_entry) @@ -87,7 +91,7 @@ class TransmissionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class TransmissionOptionsFlowHandler(config_entries.OptionsFlow): """Handle Transmission client options.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize Transmission options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/wiffi/config_flow.py b/homeassistant/components/wiffi/config_flow.py index 5087915181e..d6da03c2134 100644 --- a/homeassistant/components/wiffi/config_flow.py +++ b/homeassistant/components/wiffi/config_flow.py @@ -2,6 +2,8 @@ Used by UI to setup a wiffi integration. """ +from __future__ import annotations + import errno import voluptuous as vol @@ -21,7 +23,9 @@ class WiffiFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> OptionsFlowHandler: """Create Wiffi server setup option flow.""" return OptionsFlowHandler(config_entry) @@ -66,7 +70,7 @@ class WiffiFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Wiffi server setup option flow.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/ws66i/config_flow.py b/homeassistant/components/ws66i/config_flow.py index b84872da036..a7deb74eb3e 100644 --- a/homeassistant/components/ws66i/config_flow.py +++ b/homeassistant/components/ws66i/config_flow.py @@ -1,4 +1,6 @@ """Config flow for WS66i 6-Zone Amplifier integration.""" +from __future__ import annotations + import logging from typing import Any @@ -114,7 +116,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @core.callback - def async_get_options_flow(config_entry): + def async_get_options_flow( + config_entry: config_entries.ConfigEntry, + ) -> Ws66iOptionsFlowHandler: """Define the config flow to handle options.""" return Ws66iOptionsFlowHandler(config_entry) @@ -131,7 +135,7 @@ def _key_for_source(index, source, previous_sources): class Ws66iOptionsFlowHandler(config_entries.OptionsFlow): """Handle a WS66i options flow.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize.""" self.config_entry = config_entry diff --git a/homeassistant/components/yeelight/config_flow.py b/homeassistant/components/yeelight/config_flow.py index 440b717fd8c..5a457b7da95 100644 --- a/homeassistant/components/yeelight/config_flow.py +++ b/homeassistant/components/yeelight/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Yeelight integration.""" +from __future__ import annotations + import asyncio import logging from urllib.parse import urlparse @@ -10,7 +12,7 @@ from yeelight.main import get_known_models from homeassistant import config_entries, exceptions from homeassistant.components import dhcp, ssdp, zeroconf -from homeassistant.config_entries import ConfigEntryState +from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_ID, CONF_MODEL, CONF_NAME from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult @@ -46,7 +48,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback - def async_get_options_flow(config_entry): + def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlowHandler: """Return the options flow.""" return OptionsFlowHandler(config_entry) @@ -276,7 +278,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Handle a option flow for Yeelight.""" - def __init__(self, config_entry): + def __init__(self, config_entry: ConfigEntry) -> None: """Initialize the option flow.""" self._config_entry = config_entry