mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Allow easier customization of whole domain, entity lists, globs. (#5215)
This commit is contained in:
committed by
Johann Kellerman
parent
ab19577322
commit
addc2c4340
@@ -376,6 +376,8 @@ def ordered_dict(value_validator, key_validator=match_all):
|
||||
"""Validate ordered dict."""
|
||||
config = OrderedDict()
|
||||
|
||||
if not isinstance(value, dict):
|
||||
raise vol.Invalid('Value {} is not a dictionary'.format(value))
|
||||
for key, val in value.items():
|
||||
v_res = item_validator({key: val})
|
||||
config.update(v_res)
|
||||
@@ -385,6 +387,13 @@ def ordered_dict(value_validator, key_validator=match_all):
|
||||
return validator
|
||||
|
||||
|
||||
def ensure_list_csv(value: Any) -> Sequence:
|
||||
"""Ensure that input is a list or make one from comma-separated string."""
|
||||
if isinstance(value, str):
|
||||
return [member.strip() for member in value.split(',')]
|
||||
return ensure_list(value)
|
||||
|
||||
|
||||
# Validator helpers
|
||||
|
||||
def key_dependency(key, dependency):
|
||||
|
||||
Reference in New Issue
Block a user