mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Enforce flow-handler result type hint for step_* (#72834)
This commit is contained in:
parent
35df012b6e
commit
c19a8ef8e0
@ -37,6 +37,8 @@ class TypeHintMatch:
|
|||||||
self.function_name == node.name
|
self.function_name == node.name
|
||||||
or self.has_async_counterpart
|
or self.has_async_counterpart
|
||||||
and node.name == f"async_{self.function_name}"
|
and node.name == f"async_{self.function_name}"
|
||||||
|
or self.function_name.endswith("*")
|
||||||
|
and node.name.startswith(self.function_name[:-1])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -370,6 +372,16 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
|||||||
|
|
||||||
_CLASS_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
_CLASS_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
"config_flow": [
|
"config_flow": [
|
||||||
|
ClassTypeHintMatch(
|
||||||
|
base_class="FlowHandler",
|
||||||
|
matches=[
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="async_step_*",
|
||||||
|
arg_types={},
|
||||||
|
return_type="FlowResult",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
ClassTypeHintMatch(
|
ClassTypeHintMatch(
|
||||||
base_class="ConfigFlow",
|
base_class="ConfigFlow",
|
||||||
matches=[
|
matches=[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user