Simplify homekit_controller cache clear (#114692)

pull/114720/head
J. Nick Koston 2024-04-02 21:45:08 -10:00 committed by GitHub
parent 05c1963815
commit 7a543af8ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 6 deletions

View File

@ -2,7 +2,6 @@
from __future__ import annotations
import contextlib
from typing import Any
from aiohomekit.model.characteristics import (
@ -80,11 +79,7 @@ class HomeKitEntity(Entity):
def _async_clear_property_cache(self, properties: tuple[str, ...]) -> None:
"""Clear the cache of properties."""
for prop in properties:
# suppress is slower than try-except-pass, but
# we do not expect to have many properties to clear
# or this to be called often.
with contextlib.suppress(AttributeError):
delattr(self, prop)
self.__dict__.pop(prop, None)
@callback
def _async_reconfigure(self) -> None: