Enable types from aiohomekit to be used by mypy for homekit_controller (#65433)

This commit is contained in:
Jc2k 2022-02-03 16:18:03 +00:00 committed by GitHub
parent 6c38a6b569
commit 714a952d73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 200 additions and 90 deletions

View file

@ -51,13 +51,14 @@ class EntityMapStorage:
async def async_initialize(self) -> None:
"""Get the pairing cache data."""
if not (raw_storage := cast(StorageLayout, await self.store.async_load())):
if not (raw_storage := await self.store.async_load()):
# There is no cached data about HomeKit devices yet
return
self.storage_data = raw_storage.get("pairings", {})
storage = cast(StorageLayout, raw_storage)
self.storage_data = storage.get("pairings", {})
def get_map(self, homekit_id) -> Pairing | None:
def get_map(self, homekit_id: str) -> Pairing | None:
"""Get a pairing cache item."""
return self.storage_data.get(homekit_id)