Add async_get_options_flow type hints (n-z) (#73431)

pull/73444/head
epenet 2022-06-13 13:30:41 +02:00 committed by GitHub
parent b589700651
commit 42ed0fd47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 106 additions and 35 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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]

View File

@ -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

View File

@ -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)

View File

@ -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}

View File

@ -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

View File

@ -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)

View File

@ -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))

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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