Improve FlowHandler menu_options typing (#115296)

This commit is contained in:
Marc Mueller 2024-04-12 04:14:37 +02:00 committed by GitHub
parent a48f2803b2
commit 1b24e78dd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

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

View File

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