mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Improve config flow type hints (t-z) (#125315)
This commit is contained in:
parent
af0a6d2820
commit
58056c49f7
@ -83,7 +83,9 @@ class OptionsFlowHandler(OptionsFlow):
|
|||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
self.config_entry = config_entry
|
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."""
|
"""Manage the options."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Config flow to configure WiLight."""
|
"""Config flow to configure WiLight."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import pywilight
|
import pywilight
|
||||||
@ -89,7 +90,9 @@ class WiLightFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
self.context["title_placeholders"] = {"name": self._title}
|
self.context["title_placeholders"] = {"name": self._title}
|
||||||
return await self.async_step_confirm()
|
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."""
|
"""Handle user-confirmation of discovered WiLight."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self._get_entry()
|
return self._get_entry()
|
||||||
|
@ -49,7 +49,7 @@ FIRST_ZONE = 11
|
|||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _sources_from_config(data):
|
def _sources_from_config(data: dict[str, str]) -> dict[str, str]:
|
||||||
sources_config = {
|
sources_config = {
|
||||||
str(idx + 1): data.get(source) for idx, source in enumerate(SOURCES)
|
str(idx + 1): data.get(source) for idx, source in enumerate(SOURCES)
|
||||||
}
|
}
|
||||||
@ -134,7 +134,9 @@ class WS66iConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
|
|
||||||
@callback
|
@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(
|
return vol.Required(
|
||||||
source, description={"suggested_value": previous_sources[str(index)]}
|
source, description={"suggested_value": previous_sources[str(index)]}
|
||||||
)
|
)
|
||||||
@ -147,7 +149,9 @@ class Ws66iOptionsFlowHandler(OptionsFlow):
|
|||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
self.config_entry = config_entry
|
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."""
|
"""Manage the options."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user