Improve typing in fans and locks (#73901)

This commit is contained in:
epenet 2022-06-23 16:34:40 +02:00 committed by GitHub
parent ff7d840a6c
commit 3c82c718cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 27 additions and 26 deletions

View file

@ -92,9 +92,9 @@ class TemplateLock(TemplateEntity, LockEntity):
self._optimistic = config.get(CONF_OPTIMISTIC)
@property
def assumed_state(self):
def assumed_state(self) -> bool:
"""Return true if we do optimistic updates."""
return self._optimistic
return bool(self._optimistic)
@property
def is_locked(self) -> bool:
@ -133,7 +133,7 @@ class TemplateLock(TemplateEntity, LockEntity):
self._state = None
async def async_added_to_hass(self):
async def async_added_to_hass(self) -> None:
"""Register callbacks."""
self.add_template_attribute(
"_state", self._state_template, None, self._update_state