mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Simplify cv._make_entity_service_schema (#124046)
This commit is contained in:
parent
69943af68a
commit
f1b7847d1c
@ -1253,10 +1253,9 @@ TARGET_SERVICE_FIELDS = {
|
|||||||
_HAS_ENTITY_SERVICE_FIELD = has_at_least_one_key(*ENTITY_SERVICE_FIELDS)
|
_HAS_ENTITY_SERVICE_FIELD = has_at_least_one_key(*ENTITY_SERVICE_FIELDS)
|
||||||
|
|
||||||
|
|
||||||
def _make_entity_service_schema(schema: dict, extra: int) -> vol.Schema:
|
def _make_entity_service_schema(schema: dict, extra: int) -> VolSchemaType:
|
||||||
"""Create an entity service schema."""
|
"""Create an entity service schema."""
|
||||||
return vol.Schema(
|
return vol.All(
|
||||||
vol.All(
|
|
||||||
vol.Schema(
|
vol.Schema(
|
||||||
{
|
{
|
||||||
# The frontend stores data here. Don't use in core.
|
# The frontend stores data here. Don't use in core.
|
||||||
@ -1268,7 +1267,6 @@ def _make_entity_service_schema(schema: dict, extra: int) -> vol.Schema:
|
|||||||
),
|
),
|
||||||
_HAS_ENTITY_SERVICE_FIELD,
|
_HAS_ENTITY_SERVICE_FIELD,
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
BASE_ENTITY_SCHEMA = _make_entity_service_schema({}, vol.PREVENT_EXTRA)
|
BASE_ENTITY_SCHEMA = _make_entity_service_schema({}, vol.PREVENT_EXTRA)
|
||||||
@ -1276,7 +1274,7 @@ BASE_ENTITY_SCHEMA = _make_entity_service_schema({}, vol.PREVENT_EXTRA)
|
|||||||
|
|
||||||
def make_entity_service_schema(
|
def make_entity_service_schema(
|
||||||
schema: dict | None, *, extra: int = vol.PREVENT_EXTRA
|
schema: dict | None, *, extra: int = vol.PREVENT_EXTRA
|
||||||
) -> vol.Schema:
|
) -> VolSchemaType:
|
||||||
"""Create an entity service schema."""
|
"""Create an entity service schema."""
|
||||||
if not schema and extra == vol.PREVENT_EXTRA:
|
if not schema and extra == vol.PREVENT_EXTRA:
|
||||||
# If the schema is empty and we don't allow extra keys, we can return
|
# If the schema is empty and we don't allow extra keys, we can return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user