Make FlowResult a generic type (#111952)
This commit is contained in:
parent
008e025d5c
commit
82efb3d35b
13 changed files with 95 additions and 80 deletions
|
@ -1045,7 +1045,7 @@ class FlowCancelledError(Exception):
|
|||
"""Error to indicate that a flow has been cancelled."""
|
||||
|
||||
|
||||
class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
||||
class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult, str]):
|
||||
"""Manage all the config entry flows that are in progress."""
|
||||
|
||||
_flow_result = ConfigFlowResult
|
||||
|
@ -1171,7 +1171,7 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
|||
|
||||
async def async_finish_flow(
|
||||
self,
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult],
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult, str],
|
||||
result: ConfigFlowResult,
|
||||
) -> ConfigFlowResult:
|
||||
"""Finish a config flow and add an entry."""
|
||||
|
@ -1293,7 +1293,7 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
|||
|
||||
async def async_post_init(
|
||||
self,
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult],
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult, str],
|
||||
result: ConfigFlowResult,
|
||||
) -> None:
|
||||
"""After a flow is initialised trigger new flow notifications."""
|
||||
|
@ -1940,7 +1940,7 @@ def _async_abort_entries_match(
|
|||
raise data_entry_flow.AbortFlow("already_configured")
|
||||
|
||||
|
||||
class ConfigEntryBaseFlow(data_entry_flow.FlowHandler[ConfigFlowResult]):
|
||||
class ConfigEntryBaseFlow(data_entry_flow.FlowHandler[ConfigFlowResult, str]):
|
||||
"""Base class for config and option flows."""
|
||||
|
||||
_flow_result = ConfigFlowResult
|
||||
|
@ -2292,7 +2292,7 @@ class ConfigFlow(ConfigEntryBaseFlow):
|
|||
return self.async_abort(reason=reason)
|
||||
|
||||
|
||||
class OptionsFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
||||
class OptionsFlowManager(data_entry_flow.FlowManager[ConfigFlowResult, str]):
|
||||
"""Flow to set options for a configuration entry."""
|
||||
|
||||
_flow_result = ConfigFlowResult
|
||||
|
@ -2322,7 +2322,7 @@ class OptionsFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
|||
|
||||
async def async_finish_flow(
|
||||
self,
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult],
|
||||
flow: data_entry_flow.FlowHandler[ConfigFlowResult, str],
|
||||
result: ConfigFlowResult,
|
||||
) -> ConfigFlowResult:
|
||||
"""Finish an options flow and update options for configuration entry.
|
||||
|
@ -2344,7 +2344,7 @@ class OptionsFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
|||
return result
|
||||
|
||||
async def _async_setup_preview(
|
||||
self, flow: data_entry_flow.FlowHandler[ConfigFlowResult]
|
||||
self, flow: data_entry_flow.FlowHandler[ConfigFlowResult, str]
|
||||
) -> None:
|
||||
"""Set up preview for an option flow handler."""
|
||||
entry = self._async_get_config_entry(flow.handler)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue