forked from home-assistant/core
Make name a non cached property
This commit is contained in:
@@ -18,6 +18,7 @@ import time
|
|||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
from typing import TYPE_CHECKING, Any, Final, Literal, NotRequired, TypedDict, final
|
from typing import TYPE_CHECKING, Any, Final, Literal, NotRequired, TypedDict, final
|
||||||
|
|
||||||
|
from propcache.api import cached_property
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@@ -62,8 +63,6 @@ from .event import (
|
|||||||
from .frame import report_non_thread_safe_operation
|
from .frame import report_non_thread_safe_operation
|
||||||
from .typing import UNDEFINED, StateType, UndefinedType
|
from .typing import UNDEFINED, StateType, UndefinedType
|
||||||
|
|
||||||
cached_property = property
|
|
||||||
|
|
||||||
timer = time.time
|
timer = time.time
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -414,7 +413,6 @@ CACHED_PROPERTIES_WITH_ATTR_ = {
|
|||||||
"extra_state_attributes",
|
"extra_state_attributes",
|
||||||
"force_update",
|
"force_update",
|
||||||
"icon",
|
"icon",
|
||||||
"name",
|
|
||||||
"should_poll",
|
"should_poll",
|
||||||
"state",
|
"state",
|
||||||
"supported_features",
|
"supported_features",
|
||||||
@@ -731,7 +729,7 @@ class Entity(
|
|||||||
name = self.name
|
name = self.name
|
||||||
return None if name is UNDEFINED else name
|
return None if name is UNDEFINED else name
|
||||||
|
|
||||||
@cached_property
|
@property
|
||||||
def name(self) -> str | UndefinedType | None:
|
def name(self) -> str | UndefinedType | None:
|
||||||
"""Return the name of the entity."""
|
"""Return the name of the entity."""
|
||||||
# The check for self.platform guards against integrations not using an
|
# The check for self.platform guards against integrations not using an
|
||||||
|
Reference in New Issue
Block a user