Allow None in add_suggested_values_to_schema (#85763)

This commit is contained in:
epenet 2023-01-16 11:36:21 +01:00 committed by GitHub
parent 11a81dc485
commit 13cfd60019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -457,7 +457,7 @@ class FlowHandler:
return self.context.get("show_advanced_options", False)
def add_suggested_values_to_schema(
self, data_schema: vol.Schema, suggested_values: Mapping[str, Any]
self, data_schema: vol.Schema, suggested_values: Mapping[str, Any] | None
) -> vol.Schema:
"""Make a copy of the schema, populated with suggested values.
@ -477,7 +477,11 @@ class FlowHandler:
continue
new_key = key
if key in suggested_values and isinstance(key, vol.Marker):
if (
suggested_values
and key in suggested_values
and isinstance(key, vol.Marker)
):
# Copy the marker to not modify the flow schema
new_key = copy.copy(key)
new_key.description = {"suggested_value": suggested_values[key]}