Type hint improvements (#28260)

* Add and improve core and config_entries type hints

* Complete and improve config_entries type hints

* More entity registry type hints

* Complete helpers.event type hints
This commit is contained in:
Ville Skyttä 2019-10-28 22:36:26 +02:00 committed by Paulus Schoutsen
parent f7a64019b6
commit f88ead597a
9 changed files with 135 additions and 89 deletions

View file

@ -12,7 +12,7 @@ from homeassistant.const import (
STATE_ON,
STATE_UNAVAILABLE,
)
from homeassistant.core import State, callback
from homeassistant.core import CALLBACK_TYPE, State, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_state_change
@ -56,7 +56,7 @@ class LightSwitch(Light):
self._switch_entity_id = switch_entity_id
self._is_on = False
self._available = False
self._async_unsub_state_changed = None
self._async_unsub_state_changed: Optional[CALLBACK_TYPE] = None
@property
def name(self) -> str:
@ -113,6 +113,7 @@ class LightSwitch(Light):
"""Handle child updates."""
self.async_schedule_update_ha_state(True)
assert self.hass is not None
self._async_unsub_state_changed = async_track_state_change(
self.hass, self._switch_entity_id, async_state_changed_listener
)