Fix docstring in SchemaFlowFormStep (#82612)

This commit is contained in:
Erik Montnemery 2022-11-24 20:30:23 +01:00 committed by GitHub
parent 635d8c01fb
commit 978122c882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,8 +25,13 @@ class SchemaFlowError(Exception):
class SchemaFlowFormStep: class SchemaFlowFormStep:
"""Define a config or options flow step.""" """Define a config or options flow step."""
# Optional schema for requesting and validating user input. If schema validation # Optional voluptuous schema, or function which returns a schema or None, for
# fails, the step will be retried. If the schema is None, no user input is requested. # requesting and validating user input.
# If a function is specified, the function will be passed the handler, which is
# either an instance of SchemaConfigFlowHandler or SchemaOptionsFlowHandler, and the
# union of config entry options and user input from previous steps.
# If schema validation fails, the step will be retried. If the schema is None, no
# user input is requested.
schema: vol.Schema | Callable[ schema: vol.Schema | Callable[
[SchemaConfigFlowHandler | SchemaOptionsFlowHandler, dict[str, Any]], [SchemaConfigFlowHandler | SchemaOptionsFlowHandler, dict[str, Any]],
vol.Schema | None, vol.Schema | None,
@ -49,20 +54,6 @@ class SchemaFlowFormStep:
- If `next_step` is None, the flow is ended with `FlowResultType.CREATE_ENTRY`. - If `next_step` is None, the flow is ended with `FlowResultType.CREATE_ENTRY`.
""" """
# Optional function to allow amending a form schema.
# The update_form_schema function is called before async_show_form is called. The
# update_form_schema function is passed the handler, which is either an instance of
# SchemaConfigFlowHandler or SchemaOptionsFlowHandler, the schema, and the union of
# config entry options and user input from previous steps.
update_form_schema: Callable[
[
SchemaConfigFlowHandler | SchemaOptionsFlowHandler,
vol.Schema,
dict[str, Any],
],
vol.Schema,
] = lambda _handler, schema, _options: schema
@dataclass @dataclass
class SchemaFlowMenuStep: class SchemaFlowMenuStep: