Remove quotes surrounding annotations (#117817)

This commit is contained in:
Marc Mueller 2024-05-20 22:06:58 +02:00 committed by GitHub
parent 1ad8151bd1
commit bc2ee96cae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 59 additions and 23 deletions

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
@ -12,7 +14,7 @@ from .const import DOMAIN
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.exclude_domain(DOMAIN) registry.exclude_domain(DOMAIN)

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import ( from homeassistant.const import (
@ -22,7 +24,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
@ -13,7 +15,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_CLOSED, STATE_OPEN from homeassistant.const import STATE_CLOSED, STATE_OPEN
@ -13,7 +15,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
# On means open, Off means closed # On means open, Off means closed

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_HOME, STATE_NOT_HOME from homeassistant.const import STATE_HOME, STATE_NOT_HOME
@ -13,7 +15,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME) registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME)

View File

@ -1,5 +1,7 @@
"""Models for the HomeKit component.""" """Models for the HomeKit component."""
from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -11,6 +13,6 @@ if TYPE_CHECKING:
class HomeKitEntryData: class HomeKitEntryData:
"""Class to hold HomeKit data.""" """Class to hold HomeKit data."""
homekit: "HomeKit" homekit: HomeKit
pairing_qr: bytes | None = None pairing_qr: bytes | None = None
pairing_qr_secret: str | None = None pairing_qr_secret: str | None = None

View File

@ -1,5 +1,7 @@
"""Handles Hue resource of type `device` mapping to Home Assistant device.""" """Handles Hue resource of type `device` mapping to Home Assistant device."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from aiohue.v2 import HueBridgeV2 from aiohue.v2 import HueBridgeV2
@ -27,7 +29,7 @@ if TYPE_CHECKING:
from ..bridge import HueBridge from ..bridge import HueBridge
async def async_setup_devices(bridge: "HueBridge"): async def async_setup_devices(bridge: HueBridge):
"""Manage setup of devices from Hue devices.""" """Manage setup of devices from Hue devices."""
entry = bridge.config_entry entry = bridge.config_entry
hass = bridge.hass hass = bridge.hass

View File

@ -1,5 +1,7 @@
"""Handle forward of events transmitted by Hue devices to HASS.""" """Handle forward of events transmitted by Hue devices to HASS."""
from __future__ import annotations
import logging import logging
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -25,7 +27,7 @@ if TYPE_CHECKING:
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
async def async_setup_hue_events(bridge: "HueBridge"): async def async_setup_hue_events(bridge: HueBridge):
"""Manage listeners for stateless Hue sensors that emit events.""" """Manage listeners for stateless Hue sensors that emit events."""
hass = bridge.hass hass = bridge.hass
api: HueBridgeV2 = bridge.api # to satisfy typing api: HueBridgeV2 = bridge.api # to satisfy typing

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import ( from homeassistant.const import (
@ -20,7 +22,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import ( from homeassistant.const import (
@ -19,7 +21,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_HOME, STATE_NOT_HOME from homeassistant.const import STATE_HOME, STATE_NOT_HOME
@ -13,7 +15,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME) registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME)

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_OK, STATE_PROBLEM from homeassistant.const import STATE_OK, STATE_PROBLEM
@ -13,7 +15,7 @@ if TYPE_CHECKING:
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states(DOMAIN, {STATE_PROBLEM}, STATE_PROBLEM, STATE_OK) registry.on_off_states(DOMAIN, {STATE_PROBLEM}, STATE_PROBLEM, STATE_OK)

View File

@ -1,5 +1,7 @@
"""Managers for each table.""" """Managers for each table."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any
from lru import LRU from lru import LRU
@ -13,9 +15,9 @@ if TYPE_CHECKING:
class BaseTableManager[_DataT]: class BaseTableManager[_DataT]:
"""Base class for table managers.""" """Base class for table managers."""
_id_map: "LRU[EventType[Any] | str, int]" _id_map: LRU[EventType[Any] | str, int]
def __init__(self, recorder: "Recorder") -> None: def __init__(self, recorder: Recorder) -> None:
"""Initialize the table manager. """Initialize the table manager.
The table manager is responsible for managing the id mappings The table manager is responsible for managing the id mappings
@ -55,7 +57,7 @@ class BaseTableManager[_DataT]:
class BaseLRUTableManager[_DataT](BaseTableManager[_DataT]): class BaseLRUTableManager[_DataT](BaseTableManager[_DataT]):
"""Base class for LRU table managers.""" """Base class for LRU table managers."""
def __init__(self, recorder: "Recorder", lru_size: int) -> None: def __init__(self, recorder: Recorder, lru_size: int) -> None:
"""Initialize the LRU table manager. """Initialize the LRU table manager.
We keep track of the most recently used items We keep track of the most recently used items

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
@ -12,7 +14,7 @@ from .const import DOMAIN
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.exclude_domain(DOMAIN) registry.exclude_domain(DOMAIN)

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
@ -13,7 +15,7 @@ from .const import DOMAIN, STATE_CLEANING, STATE_ERROR, STATE_RETURNING
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
@ -21,7 +23,7 @@ from .const import (
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.on_off_states( registry.on_off_states(

View File

@ -1,5 +1,7 @@
"""Describe group states.""" """Describe group states."""
from __future__ import annotations
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
@ -12,7 +14,7 @@ from .const import DOMAIN
@callback @callback
def async_describe_on_off_states( def async_describe_on_off_states(
hass: HomeAssistant, registry: "GroupIntegrationRegistry" hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None: ) -> None:
"""Describe group on off states.""" """Describe group on off states."""
registry.exclude_domain(DOMAIN) registry.exclude_domain(DOMAIN)

View File

@ -1,5 +1,7 @@
"""Common data structures and helpers for accessing them.""" """Common data structures and helpers for accessing them."""
from __future__ import annotations
from collections.abc import Sequence from collections.abc import Sequence
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, cast from typing import TYPE_CHECKING, cast
@ -19,9 +21,9 @@ if TYPE_CHECKING: # Avoid circular dependencies.
class WemoConfigEntryData: class WemoConfigEntryData:
"""Config entry state data.""" """Config entry state data."""
device_coordinators: dict[str, "DeviceCoordinator"] device_coordinators: dict[str, DeviceCoordinator]
discovery: "WemoDiscovery" discovery: WemoDiscovery
dispatcher: "WemoDispatcher" dispatcher: WemoDispatcher
@dataclass @dataclass
@ -29,7 +31,7 @@ class WemoData:
"""Component state data.""" """Component state data."""
discovery_enabled: bool discovery_enabled: bool
static_config: Sequence["HostPortTuple"] static_config: Sequence[HostPortTuple]
registry: pywemo.SubscriptionRegistry registry: pywemo.SubscriptionRegistry
# config_entry_data is set when the config entry is loaded and unset when it's # config_entry_data is set when the config entry is loaded and unset when it's
# unloaded. It's a programmer error if config_entry_data is accessed when the # unloaded. It's a programmer error if config_entry_data is accessed when the