Simplify homekit_controller cache clear (#114692)
parent
05c1963815
commit
7a543af8ee
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue