mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Simplify homekit_controller cache clear (#114692)
This commit is contained in:
parent
05c1963815
commit
7a543af8ee
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiohomekit.model.characteristics import (
|
from aiohomekit.model.characteristics import (
|
||||||
@ -80,11 +79,7 @@ class HomeKitEntity(Entity):
|
|||||||
def _async_clear_property_cache(self, properties: tuple[str, ...]) -> None:
|
def _async_clear_property_cache(self, properties: tuple[str, ...]) -> None:
|
||||||
"""Clear the cache of properties."""
|
"""Clear the cache of properties."""
|
||||||
for prop in properties:
|
for prop in properties:
|
||||||
# suppress is slower than try-except-pass, but
|
self.__dict__.pop(prop, None)
|
||||||
# we do not expect to have many properties to clear
|
|
||||||
# or this to be called often.
|
|
||||||
with contextlib.suppress(AttributeError):
|
|
||||||
delattr(self, prop)
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_reconfigure(self) -> None:
|
def _async_reconfigure(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user