Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion homeassistant/components/wiffi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def __init__(self, config_entry: ConfigEntry) -> None:
"""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)
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/wilight/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Config flow to configure WiLight."""

from typing import Any
from urllib.parse import urlparse

import pywilight
Expand Down Expand Up @@ -89,7 +90,9 @@ async def async_step_ssdp(
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()
Expand Down
10 changes: 7 additions & 3 deletions homeassistant/components/ws66i/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


@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)
}
Expand Down Expand Up @@ -134,7 +134,9 @@ def async_get_options_flow(


@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)]}
)
Expand All @@ -147,7 +149,9 @@ def __init__(self, config_entry: ConfigEntry) -> None:
"""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(
Expand Down