From 58056c49f7e782548075109df6b9628175c65cf8 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:08:13 +0200 Subject: [PATCH] Improve config flow type hints (t-z) (#125315) --- homeassistant/components/wiffi/config_flow.py | 4 +++- homeassistant/components/wilight/config_flow.py | 5 ++++- homeassistant/components/ws66i/config_flow.py | 10 +++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/wiffi/config_flow.py b/homeassistant/components/wiffi/config_flow.py index 6e4872ea400..3fcbef395e6 100644 --- a/homeassistant/components/wiffi/config_flow.py +++ b/homeassistant/components/wiffi/config_flow.py @@ -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) diff --git a/homeassistant/components/wilight/config_flow.py b/homeassistant/components/wilight/config_flow.py index babc011fc35..8795da19091 100644 --- a/homeassistant/components/wilight/config_flow.py +++ b/homeassistant/components/wilight/config_flow.py @@ -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() diff --git a/homeassistant/components/ws66i/config_flow.py b/homeassistant/components/ws66i/config_flow.py index 330e9963f95..9f6f4ca59c2 100644 --- a/homeassistant/components/ws66i/config_flow.py +++ b/homeassistant/components/ws66i/config_flow.py @@ -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(