Make dataclasses in HA core slotted (#91208)
parent
eb63bc7967
commit
3a72054f93
|
@ -32,7 +32,7 @@ class TemplateError(HomeAssistantError):
|
|||
super().__init__(f"{exception.__class__.__name__}: {exception}")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ConditionError(HomeAssistantError):
|
||||
"""Error during condition evaluation."""
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ConditionError(HomeAssistantError):
|
|||
return "\n".join(list(self.output(indent=0)))
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ConditionErrorMessage(ConditionError):
|
||||
"""Condition error message."""
|
||||
|
||||
|
@ -64,7 +64,7 @@ class ConditionErrorMessage(ConditionError):
|
|||
yield self._indent(indent, f"In '{self.type}' condition: {self.message}")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ConditionErrorIndex(ConditionError):
|
||||
"""Condition error with index."""
|
||||
|
||||
|
@ -87,7 +87,7 @@ class ConditionErrorIndex(ConditionError):
|
|||
yield from self.error.output(indent + 1)
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ConditionErrorContainer(ConditionError):
|
||||
"""Condition error with subconditions."""
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ CHANGE_REMOVED = "removed"
|
|||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class CollectionChangeSet:
|
||||
"""Class to represent a change set.
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ class EntityPlatformState(Enum):
|
|||
REMOVED = auto()
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class EntityDescription:
|
||||
"""A class that describes Home Assistant entities."""
|
||||
|
||||
|
@ -981,7 +981,7 @@ class Entity(ABC):
|
|||
return report_issue
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class ToggleEntityDescription(EntityDescription):
|
||||
"""A class that describes toggle entities."""
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ RANDOM_MICROSECOND_MAX = 500000
|
|||
_P = ParamSpec("_P")
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class TrackStates:
|
||||
"""Class for keeping track of states being tracked.
|
||||
|
||||
|
@ -80,7 +80,7 @@ class TrackStates:
|
|||
domains: set[str]
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class TrackTemplate:
|
||||
"""Class for keeping track of a template with variables.
|
||||
|
||||
|
@ -94,7 +94,7 @@ class TrackTemplate:
|
|||
rate_limit: timedelta | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class TrackTemplateResult:
|
||||
"""Class for result of template tracking.
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
DATA_INTEGRATION_PLATFORMS = "integration_platforms"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class IntegrationPlatform:
|
||||
"""An integration platform."""
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ class IntentResponseTargetType(str, Enum):
|
|||
CUSTOM = "custom"
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class IntentResponseTarget:
|
||||
"""Target of the intent response."""
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class IssueSeverity(StrEnum):
|
|||
WARNING = "warning"
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@dataclasses.dataclass(slots=True, frozen=True)
|
||||
class IssueEntry:
|
||||
"""Issue Registry Entry."""
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||
DOMAIN = "recorder"
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class RecorderData:
|
||||
"""Recorder data stored in hass.data."""
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class SchemaFlowStep:
|
|||
"""Define a config or options flow step."""
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class SchemaFlowFormStep(SchemaFlowStep):
|
||||
"""Define a config or options flow form step."""
|
||||
|
||||
|
@ -79,7 +79,7 @@ class SchemaFlowFormStep(SchemaFlowStep):
|
|||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class SchemaFlowMenuStep(SchemaFlowStep):
|
||||
"""Define a config or options flow menu step."""
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ class ServiceTargetSelector:
|
|||
return bool(self.entity_ids or self.device_ids or self.area_ids)
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
@dataclasses.dataclass(slots=True)
|
||||
class SelectedEntities:
|
||||
"""Class to hold the selected entities."""
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.data_entry_flow import BaseServiceInfo
|
|||
ReceivePayloadType = str | bytes
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class MqttServiceInfo(BaseServiceInfo):
|
||||
"""Prepared info from mqtt entries."""
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class TriggerInfo(TypedDict):
|
|||
trigger_data: TriggerData
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class PluggableActionsEntry:
|
||||
"""Holder to keep track of all plugs and actions for a given trigger."""
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class USBMatcher(USBMatcherRequired, USBMatcherOptional):
|
|||
"""Matcher for the bluetooth integration."""
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(slots=True)
|
||||
class HomeKitDiscoveredIntegration:
|
||||
"""HomeKit model."""
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ ALPINE_RELEASE_FILE = "/etc/alpine-release"
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
@dataclasses.dataclass(slots=True)
|
||||
class RuntimeConfig:
|
||||
"""Class to hold the information for running Home Assistant."""
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class NodeDictClass(dict):
|
|||
"""Wrapper class to be able to add attributes on a dict."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(slots=True, frozen=True)
|
||||
class Input:
|
||||
"""Input that should be substituted."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue