From 1b24e78dd911ec4655a9b0b354708f3972244a2b Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 12 Apr 2024 04:14:37 +0200 Subject: [PATCH] Improve FlowHandler menu_options typing (#115296) --- homeassistant/data_entry_flow.py | 6 +++--- homeassistant/helpers/schema_config_entry_flow.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 649c9fdf8a4..7e7019681af 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -4,7 +4,7 @@ from __future__ import annotations import abc import asyncio -from collections.abc import Callable, Iterable, Mapping +from collections.abc import Callable, Container, Iterable, Mapping from contextlib import suppress import copy from dataclasses import dataclass @@ -153,7 +153,7 @@ class FlowResult(TypedDict, Generic[_HandlerT], total=False): flow_id: Required[str] handler: Required[_HandlerT] last_step: bool | None - menu_options: list[str] | dict[str, str] + menu_options: Container[str] options: Mapping[str, Any] preview: str | None progress_action: str @@ -843,7 +843,7 @@ class FlowHandler(Generic[_FlowResultT, _HandlerT]): self, *, step_id: str | None = None, - menu_options: list[str] | dict[str, str], + menu_options: Container[str], description_placeholders: Mapping[str, str] | None = None, ) -> _FlowResultT: """Show a navigation menu to the user. diff --git a/homeassistant/helpers/schema_config_entry_flow.py b/homeassistant/helpers/schema_config_entry_flow.py index 978ce949eb3..67624bfb368 100644 --- a/homeassistant/helpers/schema_config_entry_flow.py +++ b/homeassistant/helpers/schema_config_entry_flow.py @@ -3,7 +3,7 @@ from __future__ import annotations from abc import ABC, abstractmethod -from collections.abc import Callable, Coroutine, Mapping +from collections.abc import Callable, Container, Coroutine, Mapping import copy from dataclasses import dataclass import types @@ -102,7 +102,7 @@ class SchemaFlowMenuStep(SchemaFlowStep): """Define a config or options flow menu step.""" # Menu options - options: list[str] | dict[str, str] + options: Container[str] class SchemaCommonFlowHandler: