Postponed evaluation of annotations for integrations (#46455)
parent
061d9c5293
commit
dd8d4471ec
|
@ -1,4 +1,6 @@
|
|||
"""Reads vehicle status from BMW connected drive portal."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
|
@ -195,7 +197,7 @@ async def update_listener(hass, config_entry):
|
|||
await hass.config_entries.async_reload(config_entry.entry_id)
|
||||
|
||||
|
||||
def setup_account(entry: ConfigEntry, hass, name: str) -> "BMWConnectedDriveAccount":
|
||||
def setup_account(entry: ConfigEntry, hass, name: str) -> BMWConnectedDriveAccount:
|
||||
"""Set up a new BMWConnectedDriveAccount based on the config."""
|
||||
username = entry.data[CONF_USERNAME]
|
||||
password = entry.data[CONF_PASSWORD]
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Helpers to deal with Cast devices."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import attr
|
||||
|
@ -57,7 +59,7 @@ class ChromecastInfo:
|
|||
return None
|
||||
return CAST_MANUFACTURERS.get(self.model_name.lower(), "Google Inc.")
|
||||
|
||||
def fill_out_missing_chromecast_info(self) -> "ChromecastInfo":
|
||||
def fill_out_missing_chromecast_info(self) -> ChromecastInfo:
|
||||
"""Return a new ChromecastInfo object with missing attributes filled in.
|
||||
|
||||
Uses blocking HTTP / HTTPS.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Component to count within automations."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
@ -179,7 +181,7 @@ class Counter(RestoreEntity):
|
|||
self.editable: bool = True
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: Dict) -> "Counter":
|
||||
def from_yaml(cls, config: Dict) -> Counter:
|
||||
"""Create counter instance from yaml config."""
|
||||
counter = cls(config)
|
||||
counter.editable = False
|
||||
|
|
|
@ -78,11 +78,11 @@ class EsphomeTextSensor(EsphomeEntity):
|
|||
"""A text sensor implementation for ESPHome."""
|
||||
|
||||
@property
|
||||
def _static_info(self) -> "TextSensorInfo":
|
||||
def _static_info(self) -> TextSensorInfo:
|
||||
return super()._static_info
|
||||
|
||||
@property
|
||||
def _state(self) -> Optional["TextSensorState"]:
|
||||
def _state(self) -> Optional[TextSensorState]:
|
||||
return super()._state
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Config flow for the Huawei LTE platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import OrderedDict
|
||||
import logging
|
||||
|
@ -48,7 +49,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: config_entries.ConfigEntry,
|
||||
) -> "OptionsFlowHandler":
|
||||
) -> OptionsFlowHandler:
|
||||
"""Get options flow."""
|
||||
return OptionsFlowHandler(config_entry)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for Huawei LTE router notifications."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import time
|
||||
|
@ -21,7 +22,7 @@ async def async_get_service(
|
|||
hass: HomeAssistantType,
|
||||
config: Dict[str, Any],
|
||||
discovery_info: Optional[Dict[str, Any]] = None,
|
||||
) -> Optional["HuaweiLteSmsNotificationService"]:
|
||||
) -> Optional[HuaweiLteSmsNotificationService]:
|
||||
"""Get the notification service."""
|
||||
if discovery_info is None:
|
||||
return None
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support to keep track of user controlled booleans for within automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import typing
|
||||
|
||||
|
@ -150,7 +152,7 @@ class InputBoolean(ToggleEntity, RestoreEntity):
|
|||
self._state = config.get(CONF_INITIAL)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputBoolean":
|
||||
def from_yaml(cls, config: typing.Dict) -> InputBoolean:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_bool = cls(config)
|
||||
input_bool.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support to select a date and/or a time."""
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime as py_datetime
|
||||
import logging
|
||||
import typing
|
||||
|
@ -228,7 +230,7 @@ class InputDatetime(RestoreEntity):
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputDatetime":
|
||||
def from_yaml(cls, config: typing.Dict) -> InputDatetime:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_dt = cls(config)
|
||||
input_dt.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support to set a numeric value from a slider or text box."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import typing
|
||||
|
||||
|
@ -202,7 +204,7 @@ class InputNumber(RestoreEntity):
|
|||
self._current_value = config.get(CONF_INITIAL)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputNumber":
|
||||
def from_yaml(cls, config: typing.Dict) -> InputNumber:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_num = cls(config)
|
||||
input_num.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support to select an option from a list."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import typing
|
||||
|
||||
|
@ -207,7 +209,7 @@ class InputSelect(RestoreEntity):
|
|||
self._current_option = config.get(CONF_INITIAL)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputSelect":
|
||||
def from_yaml(cls, config: typing.Dict) -> InputSelect:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_select = cls(config)
|
||||
input_select.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support to enter a value into a text box."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import typing
|
||||
|
||||
|
@ -196,7 +198,7 @@ class InputText(RestoreEntity):
|
|||
self._current_value = config.get(CONF_INITIAL)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: typing.Dict) -> "InputText":
|
||||
def from_yaml(cls, config: typing.Dict) -> InputText:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
input_text = cls(config)
|
||||
input_text.entity_id = f"{DOMAIN}.{config[CONF_ID]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Provides functionality to interact with lights."""
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import dataclasses
|
||||
from datetime import timedelta
|
||||
|
@ -327,7 +329,7 @@ class Profile:
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def from_csv_row(cls, csv_row: List[str]) -> "Profile":
|
||||
def from_csv_row(cls, csv_row: List[str]) -> Profile:
|
||||
"""Create profile from a CSV row tuple."""
|
||||
return cls(*cls.SCHEMA(csv_row))
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Component to interface with various media players."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import collections
|
||||
|
@ -851,7 +853,7 @@ class MediaPlayerEntity(Entity):
|
|||
self,
|
||||
media_content_type: Optional[str] = None,
|
||||
media_content_id: Optional[str] = None,
|
||||
) -> "BrowseMedia":
|
||||
) -> BrowseMedia:
|
||||
"""Return a BrowseMedia instance.
|
||||
|
||||
The BrowseMedia instance will be used by the
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Media Source models."""
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Optional, Tuple
|
||||
|
@ -82,12 +84,12 @@ class MediaSourceItem:
|
|||
return await self.async_media_source().async_resolve_media(self)
|
||||
|
||||
@callback
|
||||
def async_media_source(self) -> "MediaSource":
|
||||
def async_media_source(self) -> MediaSource:
|
||||
"""Return media source that owns this item."""
|
||||
return self.hass.data[DOMAIN][self.domain]
|
||||
|
||||
@classmethod
|
||||
def from_uri(cls, hass: HomeAssistant, uri: str) -> "MediaSourceItem":
|
||||
def from_uri(cls, hass: HomeAssistant, uri: str) -> MediaSourceItem:
|
||||
"""Create an item from a uri."""
|
||||
match = URI_SCHEME_REGEX.match(uri)
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for Timers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Dict, Optional
|
||||
|
@ -198,7 +200,7 @@ class Timer(RestoreEntity):
|
|||
self._listener = None
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: Dict) -> "Timer":
|
||||
def from_yaml(cls, config: Dict) -> Timer:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
timer = cls(config)
|
||||
timer.entity_id = ENTITY_ID_FORMAT.format(config[CONF_ID])
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for the Transmission BitTorrent client API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import List
|
||||
|
@ -176,7 +178,7 @@ class TransmissionClient:
|
|||
self.unsub_timer = None
|
||||
|
||||
@property
|
||||
def api(self) -> "TransmissionData":
|
||||
def api(self) -> TransmissionData:
|
||||
"""Return the TransmissionData object."""
|
||||
return self._tm_data
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Channels module for Zigbee Home Automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
|
@ -47,7 +49,7 @@ class Channels:
|
|||
self._zha_device = zha_device
|
||||
|
||||
@property
|
||||
def pools(self) -> List["ChannelPool"]:
|
||||
def pools(self) -> List[ChannelPool]:
|
||||
"""Return channel pools list."""
|
||||
return self._pools
|
||||
|
||||
|
@ -102,7 +104,7 @@ class Channels:
|
|||
}
|
||||
|
||||
@classmethod
|
||||
def new(cls, zha_device: zha_typing.ZhaDeviceType) -> "Channels":
|
||||
def new(cls, zha_device: zha_typing.ZhaDeviceType) -> Channels:
|
||||
"""Create new instance."""
|
||||
channels = cls(zha_device)
|
||||
for ep_id in sorted(zha_device.device.endpoints):
|
||||
|
@ -263,7 +265,7 @@ class ChannelPool:
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def new(cls, channels: Channels, ep_id: int) -> "ChannelPool":
|
||||
def new(cls, channels: Channels, ep_id: int) -> ChannelPool:
|
||||
"""Create new channels for an endpoint."""
|
||||
pool = cls(channels, ep_id)
|
||||
pool.add_all_channels()
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for the definition of zones."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any, Dict, Optional, cast
|
||||
|
||||
|
@ -285,7 +287,7 @@ class Zone(entity.Entity):
|
|||
self._generate_attrs()
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, config: Dict) -> "Zone":
|
||||
def from_yaml(cls, config: Dict) -> Zone:
|
||||
"""Return entity instance initialized from yaml storage."""
|
||||
zone = cls(config)
|
||||
zone.editable = False
|
||||
|
|
Loading…
Reference in New Issue