mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Add slots to dataclasses in default_config (#91410)
* add dataclass slots to default config items * remove slots from sun mixing
This commit is contained in:
parent
f65e06dc26
commit
f5911bcad6
@ -659,7 +659,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class AutomationEntityConfig:
|
class AutomationEntityConfig:
|
||||||
"""Container for prepared automation entity configuration."""
|
"""Container for prepared automation entity configuration."""
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from .const import DOMAIN, EXCLUDE_FROM_BACKUP, LOGGER
|
|||||||
BUF_SIZE = 2**20 * 4 # 4MB
|
BUF_SIZE = 2**20 * 4 # 4MB
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class Backup:
|
class Backup:
|
||||||
"""Backup class."""
|
"""Backup class."""
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ MONOTONIC_TIME: Final = monotonic_time_coarse
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class BluetoothScannerDevice:
|
class BluetoothScannerDevice:
|
||||||
"""Data for a bluetooth device from a given scanner."""
|
"""Data for a bluetooth device from a given scanner."""
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class BluetoothCallbackMatcherWithCallback(
|
|||||||
"""Callback matcher for the bluetooth integration that stores the callback."""
|
"""Callback matcher for the bluetooth integration that stores the callback."""
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=False)
|
@dataclass(slots=True, frozen=False)
|
||||||
class IntegrationMatchHistory:
|
class IntegrationMatchHistory:
|
||||||
"""Track which fields have been seen."""
|
"""Track which fields have been seen."""
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ MANAGER: BluetoothManager | None = None
|
|||||||
MONOTONIC_TIME: Final = monotonic_time_coarse
|
MONOTONIC_TIME: Final = monotonic_time_coarse
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class HaBluetoothConnector:
|
class HaBluetoothConnector:
|
||||||
"""Data for how to connect a BLEDevice from a given scanner."""
|
"""Data for how to connect a BLEDevice from a given scanner."""
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ if TYPE_CHECKING:
|
|||||||
from . import BluetoothChange, BluetoothScanningMode, BluetoothServiceInfoBleak
|
from . import BluetoothChange, BluetoothScanningMode, BluetoothServiceInfoBleak
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(slots=True, frozen=True)
|
||||||
class PassiveBluetoothEntityKey:
|
class PassiveBluetoothEntityKey:
|
||||||
"""Key for a passive bluetooth entity.
|
"""Key for a passive bluetooth entity.
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class PassiveBluetoothEntityKey:
|
|||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(slots=True, frozen=True)
|
||||||
class PassiveBluetoothDataUpdate(Generic[_T]):
|
class PassiveBluetoothDataUpdate(Generic[_T]):
|
||||||
"""Generic bluetooth data."""
|
"""Generic bluetooth data."""
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
|||||||
from .manager import BluetoothManager
|
from .manager import BluetoothManager
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class _HaWrappedBleakBackend:
|
class _HaWrappedBleakBackend:
|
||||||
"""Wrap bleak backend to make it usable by Home Assistant."""
|
"""Wrap bleak backend to make it usable by Home Assistant."""
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.core import Context
|
|||||||
from homeassistant.helpers import intent
|
from homeassistant.helpers import intent
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class ConversationInput:
|
class ConversationInput:
|
||||||
"""User input to be processed."""
|
"""User input to be processed."""
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ class ConversationInput:
|
|||||||
language: str
|
language: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class ConversationResult:
|
class ConversationResult:
|
||||||
"""Result of async_process."""
|
"""Result of async_process."""
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ def json_load(fp: IO[str]) -> JsonObjectType:
|
|||||||
return json_loads_object(fp.read())
|
return json_loads_object(fp.read())
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LanguageIntents:
|
class LanguageIntents:
|
||||||
"""Loaded intents for a language."""
|
"""Loaded intents for a language."""
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ async def async_setup_platform(
|
|||||||
await sensor_manager.async_start()
|
await sensor_manager.async_start()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class SourceAdapter:
|
class SourceAdapter:
|
||||||
"""Adapter to allow sources and their flows to be used as sensors."""
|
"""Adapter to allow sources and their flows to be used as sensors."""
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ def _get_placeholders(hass: HomeAssistant, issue_type: str) -> dict[str, str] |
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass(slots=True)
|
||||||
class ValidationIssue:
|
class ValidationIssue:
|
||||||
"""Error or warning message."""
|
"""Error or warning message."""
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class ValidationIssue:
|
|||||||
translation_placeholders: dict[str, str] | None = None
|
translation_placeholders: dict[str, str] | None = None
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass(slots=True)
|
||||||
class ValidationIssues:
|
class ValidationIssues:
|
||||||
"""Container for validation issues."""
|
"""Container for validation issues."""
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ class ValidationIssues:
|
|||||||
issue.affected_entities.add((affected_entity, detail))
|
issue.affected_entities.add((affected_entity, detail))
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass(slots=True)
|
||||||
class EnergyPreferencesValidation:
|
class EnergyPreferencesValidation:
|
||||||
"""Dictionary holding validation information."""
|
"""Dictionary holding validation information."""
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ from typing import Protocol
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class BoardInfo:
|
class BoardInfo:
|
||||||
"""Board info type."""
|
"""Board info type."""
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ class BoardInfo:
|
|||||||
revision: str | None
|
revision: str | None
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(slots=True, frozen=True)
|
||||||
class USBInfo:
|
class USBInfo:
|
||||||
"""USB info type."""
|
"""USB info type."""
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class USBInfo:
|
|||||||
description: str | None
|
description: str | None
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(slots=True, frozen=True)
|
||||||
class HardwareInfo:
|
class HardwareInfo:
|
||||||
"""Hardware info type."""
|
"""Hardware info type."""
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from .hardware import async_process_hardware_platforms
|
|||||||
from .models import HardwareProtocol
|
from .models import HardwareProtocol
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class SystemStatus:
|
class SystemStatus:
|
||||||
"""System status."""
|
"""System status."""
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ from .helpers import entities_may_have_state_changes_after
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class HistoryLiveStream:
|
class HistoryLiveStream:
|
||||||
"""Track a history live stream."""
|
"""Track a history live stream."""
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(slots=True, frozen=True)
|
||||||
class IntegrationAlert:
|
class IntegrationAlert:
|
||||||
"""Issue Registry Entry."""
|
"""Issue Registry Entry."""
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ from homeassistant.util.json import json_loads
|
|||||||
from homeassistant.util.ulid import ulid_to_bytes
|
from homeassistant.util.ulid import ulid_to_bytes
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LogbookConfig:
|
class LogbookConfig:
|
||||||
"""Configuration for the logbook integration."""
|
"""Configuration for the logbook integration."""
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class LazyEventPartialState:
|
|||||||
return bytes_to_ulid_or_none(self.context_parent_id_bin)
|
return bytes_to_ulid_or_none(self.context_parent_id_bin)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(slots=True, frozen=True)
|
||||||
class EventAsRow:
|
class EventAsRow:
|
||||||
"""Convert an event to a row."""
|
"""Convert an event to a row."""
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ from .queries import statement_for_request
|
|||||||
from .queries.common import PSEUDO_EVENT_STATE_CHANGED
|
from .queries.common import PSEUDO_EVENT_STATE_CHANGED
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LogbookRun:
|
class LogbookRun:
|
||||||
"""A logbook run which may be a long running event stream or single request."""
|
"""A logbook run which may be a long running event stream or single request."""
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ BIG_QUERY_RECENT_HOURS = 24
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LogbookLiveStream:
|
class LogbookLiveStream:
|
||||||
"""Track a logbook live stream."""
|
"""Track a logbook live stream."""
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ async def get_integration_loggers(hass: HomeAssistant, domain: str) -> set[str]:
|
|||||||
return loggers
|
return loggers
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LoggerSetting:
|
class LoggerSetting:
|
||||||
"""Settings for a single module or integration."""
|
"""Settings for a single module or integration."""
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class LoggerSetting:
|
|||||||
type: str
|
type: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class LoggerDomainConfig:
|
class LoggerDomainConfig:
|
||||||
"""Logger domain config."""
|
"""Logger domain config."""
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
from .const import DOMAIN, URI_SCHEME, URI_SCHEME_REGEX
|
from .const import DOMAIN, URI_SCHEME, URI_SCHEME_REGEX
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class PlayMedia:
|
class PlayMedia:
|
||||||
"""Represents a playable media."""
|
"""Represents a playable media."""
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class BrowseMediaSource(BrowseMedia):
|
|||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class MediaSourceItem:
|
class MediaSourceItem:
|
||||||
"""A parsed media item."""
|
"""A parsed media item."""
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class ScriptEntityConfig:
|
class ScriptEntityConfig:
|
||||||
"""Container for prepared script entity configuration."""
|
"""Container for prepared script entity configuration."""
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ async def handle_info(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass()
|
@dataclasses.dataclass(slots=True)
|
||||||
class SystemHealthRegistration:
|
class SystemHealthRegistration:
|
||||||
"""Helper class to track platform registration."""
|
"""Helper class to track platform registration."""
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ TRIGGER_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
|
|||||||
WEBHOOK_TRIGGERS = f"{DOMAIN}_triggers"
|
WEBHOOK_TRIGGERS = f"{DOMAIN}_triggers"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(slots=True)
|
||||||
class TriggerInstance:
|
class TriggerInstance:
|
||||||
"""Attached trigger settings."""
|
"""Attached trigger settings."""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user