Improve config flow type hints (t-z) (#125315)
parent
af0a6d2820
commit
58056c49f7
|
@ -83,7 +83,9 @@ class OptionsFlowHandler(OptionsFlow):
|
|||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
async def async_step_init(self, user_input=None):
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, int] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Manage the options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Config flow to configure WiLight."""
|
||||
|
||||
from typing import Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import pywilight
|
||||
|
@ -89,7 +90,9 @@ class WiLightFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
self.context["title_placeholders"] = {"name": self._title}
|
||||
return await self.async_step_confirm()
|
||||
|
||||
async def async_step_confirm(self, user_input=None):
|
||||
async def async_step_confirm(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle user-confirmation of discovered WiLight."""
|
||||
if user_input is not None:
|
||||
return self._get_entry()
|
||||
|
|
|
@ -49,7 +49,7 @@ FIRST_ZONE = 11
|
|||
|
||||
|
||||
@callback
|
||||
def _sources_from_config(data):
|
||||
def _sources_from_config(data: dict[str, str]) -> dict[str, str]:
|
||||
sources_config = {
|
||||
str(idx + 1): data.get(source) for idx, source in enumerate(SOURCES)
|
||||
}
|
||||
|
@ -134,7 +134,9 @@ class WS66iConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
|
||||
@callback
|
||||
def _key_for_source(index, source, previous_sources):
|
||||
def _key_for_source(
|
||||
index: int, source: str, previous_sources: dict[str, str]
|
||||
) -> vol.Required:
|
||||
return vol.Required(
|
||||
source, description={"suggested_value": previous_sources[str(index)]}
|
||||
)
|
||||
|
@ -147,7 +149,9 @@ class Ws66iOptionsFlowHandler(OptionsFlow):
|
|||
"""Initialize."""
|
||||
self.config_entry = config_entry
|
||||
|
||||
async def async_step_init(self, user_input=None):
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, str] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Manage the options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
|
|
Loading…
Reference in New Issue