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