1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Clean up input-datetime (#16000)

This commit is contained in:
Paulus Schoutsen
2018-08-16 22:17:14 +02:00
committed by GitHub
parent 2a210607d3
commit 834077190f
4 changed files with 60 additions and 112 deletions

View File

@@ -60,21 +60,6 @@ def has_at_least_one_key(*keys: str) -> Callable:
return validate
def has_at_least_one_key_value(*items: list) -> Callable:
"""Validate that at least one (key, value) pair exists."""
def validate(obj: Dict) -> Dict:
"""Test (key,value) exist in dict."""
if not isinstance(obj, dict):
raise vol.Invalid('expected dictionary')
for item in obj.items():
if item in items:
return obj
raise vol.Invalid('must contain one of {}.'.format(str(items)))
return validate
def boolean(value: Any) -> bool:
"""Validate and coerce a boolean value."""
if isinstance(value, str):