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:
rlippmann 2023-04-14 14:22:39 -04:00 committed by GitHub
parent f65e06dc26
commit f5911bcad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 32 additions and 32 deletions

View file

@ -659,7 +659,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
)
@dataclass
@dataclass(slots=True)
class AutomationEntityConfig:
"""Container for prepared automation entity configuration."""

View file

@ -26,7 +26,7 @@ from .const import DOMAIN, EXCLUDE_FROM_BACKUP, LOGGER
BUF_SIZE = 2**20 * 4 # 4MB
@dataclass
@dataclass(slots=True)
class Backup:
"""Backup class."""

View file

@ -39,7 +39,7 @@ MONOTONIC_TIME: Final = monotonic_time_coarse
_LOGGER = logging.getLogger(__name__)
@dataclass
@dataclass(slots=True)
class BluetoothScannerDevice:
"""Data for a bluetooth device from a given scanner."""

View file

@ -61,7 +61,7 @@ class BluetoothCallbackMatcherWithCallback(
"""Callback matcher for the bluetooth integration that stores the callback."""
@dataclass(frozen=False)
@dataclass(slots=True, frozen=False)
class IntegrationMatchHistory:
"""Track which fields have been seen."""

View file

@ -20,7 +20,7 @@ MANAGER: BluetoothManager | None = None
MONOTONIC_TIME: Final = monotonic_time_coarse
@dataclass
@dataclass(slots=True)
class HaBluetoothConnector:
"""Data for how to connect a BLEDevice from a given scanner."""

View file

@ -20,7 +20,7 @@ if TYPE_CHECKING:
from . import BluetoothChange, BluetoothScanningMode, BluetoothServiceInfoBleak
@dataclasses.dataclass(frozen=True)
@dataclasses.dataclass(slots=True, frozen=True)
class PassiveBluetoothEntityKey:
"""Key for a passive bluetooth entity.
@ -36,7 +36,7 @@ class PassiveBluetoothEntityKey:
_T = TypeVar("_T")
@dataclasses.dataclass(frozen=True)
@dataclasses.dataclass(slots=True, frozen=True)
class PassiveBluetoothDataUpdate(Generic[_T]):
"""Generic bluetooth data."""

View file

@ -34,7 +34,7 @@ if TYPE_CHECKING:
from .manager import BluetoothManager
@dataclass
@dataclass(slots=True)
class _HaWrappedBleakBackend:
"""Wrap bleak backend to make it usable by Home Assistant."""

View file

@ -9,7 +9,7 @@ from homeassistant.core import Context
from homeassistant.helpers import intent
@dataclass
@dataclass(slots=True)
class ConversationInput:
"""User input to be processed."""
@ -19,7 +19,7 @@ class ConversationInput:
language: str
@dataclass
@dataclass(slots=True)
class ConversationResult:
"""Result of async_process."""

View file

@ -47,7 +47,7 @@ def json_load(fp: IO[str]) -> JsonObjectType:
return json_loads_object(fp.read())
@dataclass
@dataclass(slots=True)
class LanguageIntents:
"""Loaded intents for a language."""

View file

@ -74,7 +74,7 @@ async def async_setup_platform(
await sensor_manager.async_start()
@dataclass
@dataclass(slots=True)
class SourceAdapter:
"""Adapter to allow sources and their flows to be used as sensors."""

View file

@ -107,7 +107,7 @@ def _get_placeholders(hass: HomeAssistant, issue_type: str) -> dict[str, str] |
return None
@dataclasses.dataclass
@dataclasses.dataclass(slots=True)
class ValidationIssue:
"""Error or warning message."""
@ -118,7 +118,7 @@ class ValidationIssue:
translation_placeholders: dict[str, str] | None = None
@dataclasses.dataclass
@dataclasses.dataclass(slots=True)
class ValidationIssues:
"""Container for validation issues."""
@ -142,7 +142,7 @@ class ValidationIssues:
issue.affected_entities.add((affected_entity, detail))
@dataclasses.dataclass
@dataclasses.dataclass(slots=True)
class EnergyPreferencesValidation:
"""Dictionary holding validation information."""

View file

@ -7,7 +7,7 @@ from typing import Protocol
from homeassistant.core import HomeAssistant, callback
@dataclass
@dataclass(slots=True)
class BoardInfo:
"""Board info type."""
@ -17,7 +17,7 @@ class BoardInfo:
revision: str | None
@dataclass(frozen=True)
@dataclass(slots=True, frozen=True)
class USBInfo:
"""USB info type."""
@ -28,7 +28,7 @@ class USBInfo:
description: str | None
@dataclass(frozen=True)
@dataclass(slots=True, frozen=True)
class HardwareInfo:
"""Hardware info type."""

View file

@ -20,7 +20,7 @@ from .hardware import async_process_hardware_platforms
from .models import HardwareProtocol
@dataclass
@dataclass(slots=True)
class SystemStatus:
"""System status."""

View file

@ -41,7 +41,7 @@ from .helpers import entities_may_have_state_changes_after
_LOGGER = logging.getLogger(__name__)
@dataclass
@dataclass(slots=True)
class HistoryLiveStream:
"""Track a history live stream."""

View file

@ -106,7 +106,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True
@dataclasses.dataclass(frozen=True)
@dataclasses.dataclass(slots=True, frozen=True)
class IntegrationAlert:
"""Issue Registry Entry."""

View file

@ -22,7 +22,7 @@ from homeassistant.util.json import json_loads
from homeassistant.util.ulid import ulid_to_bytes
@dataclass
@dataclass(slots=True)
class LogbookConfig:
"""Configuration for the logbook integration."""
@ -95,7 +95,7 @@ class LazyEventPartialState:
return bytes_to_ulid_or_none(self.context_parent_id_bin)
@dataclass(frozen=True)
@dataclass(slots=True, frozen=True)
class EventAsRow:
"""Convert an event to a row."""

View file

@ -61,7 +61,7 @@ from .queries import statement_for_request
from .queries.common import PSEUDO_EVENT_STATE_CHANGED
@dataclass
@dataclass(slots=True)
class LogbookRun:
"""A logbook run which may be a long running event stream or single request."""

View file

@ -39,7 +39,7 @@ BIG_QUERY_RECENT_HOURS = 24
_LOGGER = logging.getLogger(__name__)
@dataclass
@dataclass(slots=True)
class LogbookLiveStream:
"""Track a logbook live stream."""

View file

@ -77,7 +77,7 @@ async def get_integration_loggers(hass: HomeAssistant, domain: str) -> set[str]:
return loggers
@dataclass
@dataclass(slots=True)
class LoggerSetting:
"""Settings for a single module or integration."""
@ -86,7 +86,7 @@ class LoggerSetting:
type: str
@dataclass
@dataclass(slots=True)
class LoggerDomainConfig:
"""Logger domain config."""

View file

@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, callback
from .const import DOMAIN, URI_SCHEME, URI_SCHEME_REGEX
@dataclass
@dataclass(slots=True)
class PlayMedia:
"""Represents a playable media."""
@ -36,7 +36,7 @@ class BrowseMediaSource(BrowseMedia):
self.identifier = identifier
@dataclass
@dataclass(slots=True)
class MediaSourceItem:
"""A parsed media item."""

View file

@ -231,7 +231,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True
@dataclass
@dataclass(slots=True)
class ScriptEntityConfig:
"""Container for prepared script entity configuration."""

View file

@ -188,7 +188,7 @@ async def handle_info(
)
@dataclasses.dataclass()
@dataclasses.dataclass(slots=True)
class SystemHealthRegistration:
"""Helper class to track platform registration."""

View file

@ -49,7 +49,7 @@ TRIGGER_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
WEBHOOK_TRIGGERS = f"{DOMAIN}_triggers"
@dataclass
@dataclass(slots=True)
class TriggerInstance:
"""Attached trigger settings."""