Improve config flow type hints (t-z) (#125315)

pull/125417/head
epenet 2024-09-06 15:08:13 +02:00 committed by GitHub
parent af0a6d2820
commit 58056c49f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 5 deletions

View File

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

View File

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

View File

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