State and service related type hint improvements (#38956)

* Improve type hint of service_func to register

* Add named type for state values

* Narrow some unnecessarily broad state type hints
This commit is contained in:
Ville Skyttä
2020-08-17 22:02:43 +03:00
committed by GitHub
parent 4ea587804e
commit 802c556e82
6 changed files with 27 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
"""Typing Helpers for Home Assistant."""
from typing import Any, Dict, Optional, Tuple
from typing import Any, Dict, Optional, Tuple, Union
import homeassistant.core
@@ -13,6 +13,7 @@ EventType = homeassistant.core.Event
HomeAssistantType = homeassistant.core.HomeAssistant
ServiceCallType = homeassistant.core.ServiceCall
ServiceDataType = Dict[str, Any]
StateType = Union[None, str, int, float]
TemplateVarsType = Optional[Dict[str, Any]]
# Custom type for recorder Queries