Add missing type hints in locks (#73831)

This commit is contained in:
epenet 2022-06-22 17:23:51 +02:00 committed by GitHub
parent 7a407d09dc
commit 143e6a7adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,8 @@
"""Support for Sesame, by CANDY HOUSE.""" """Support for Sesame, by CANDY HOUSE."""
from __future__ import annotations from __future__ import annotations
from typing import Any
import pysesame2 import pysesame2
import voluptuous as vol import voluptuous as vol
@ -61,11 +63,11 @@ class SesameDevice(LockEntity):
"""Return True if the device is currently locked, else False.""" """Return True if the device is currently locked, else False."""
return self._is_locked return self._is_locked
def lock(self, **kwargs) -> None: def lock(self, **kwargs: Any) -> None:
"""Lock the device.""" """Lock the device."""
self._sesame.lock() self._sesame.lock()
def unlock(self, **kwargs) -> None: def unlock(self, **kwargs: Any) -> None:
"""Unlock the device.""" """Unlock the device."""
self._sesame.unlock() self._sesame.unlock()

View File

@ -2,6 +2,7 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from typing import Any
from verisure import Error as VerisureError from verisure import Error as VerisureError
@ -122,7 +123,7 @@ class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEnt
"""Return the state attributes.""" """Return the state attributes."""
return {"method": self.changed_method} return {"method": self.changed_method}
async def async_unlock(self, **kwargs) -> None: async def async_unlock(self, **kwargs: Any) -> None:
"""Send unlock command.""" """Send unlock command."""
code = kwargs.get( code = kwargs.get(
ATTR_CODE, self.coordinator.entry.options.get(CONF_LOCK_DEFAULT_CODE) ATTR_CODE, self.coordinator.entry.options.get(CONF_LOCK_DEFAULT_CODE)
@ -133,7 +134,7 @@ class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEnt
await self.async_set_lock_state(code, STATE_UNLOCKED) await self.async_set_lock_state(code, STATE_UNLOCKED)
async def async_lock(self, **kwargs) -> None: async def async_lock(self, **kwargs: Any) -> None:
"""Send lock command.""" """Send lock command."""
code = kwargs.get( code = kwargs.get(
ATTR_CODE, self.coordinator.entry.options.get(CONF_LOCK_DEFAULT_CODE) ATTR_CODE, self.coordinator.entry.options.get(CONF_LOCK_DEFAULT_CODE)