mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Update typing syntax (#49480)
* Update typing syntax * Replace typing imports with ones from collections where possible * Changes after review
This commit is contained in:
parent
34245c3add
commit
c07646db5d
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -1,5 +1,8 @@
|
||||
"""Blueprint errors."""
|
||||
from typing import Any, Iterable
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, Callable, Mapping
|
||||
from typing import Any, Callable
|
||||
|
||||
from pyclimacell.const import CURRENT
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Mapping
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from typing import Any, Callable, Mapping
|
||||
from typing import Any, Callable
|
||||
|
||||
from pyclimacell.const import (
|
||||
CURRENT,
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_TEMPERATURE
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_CURRENT_POSITION,
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""Support for Denon AVR receivers using their HTTP interface."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Coroutine
|
||||
from datetime import timedelta
|
||||
from functools import wraps
|
||||
import logging
|
||||
from typing import Coroutine
|
||||
|
||||
from denonavr import DenonAVR
|
||||
from denonavr.const import POWER_ON
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import MutableMapping
|
||||
from functools import wraps
|
||||
from types import ModuleType
|
||||
from typing import Any, MutableMapping
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
import voluptuous_serialize
|
||||
|
@ -2,10 +2,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Sequence
|
||||
from datetime import timedelta
|
||||
import hashlib
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Sequence, final
|
||||
from typing import Any, Callable, final
|
||||
|
||||
import attr
|
||||
import voluptuous as vol
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""Support for the DIRECTV remote."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from directv import DIRECTV, DIRECTVError
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""Common code for GogoGate2 component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Awaitable, Callable, NamedTuple
|
||||
from typing import Callable, NamedTuple
|
||||
|
||||
from gogogate2_api import AbstractGateApi, GogoGate2Api, ISmartGateApi
|
||||
from gogogate2_api.common import AbstractDoor, get_door_by_id
|
||||
|
@ -3,9 +3,10 @@ from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
from contextvars import ContextVar
|
||||
import logging
|
||||
from typing import Any, Iterable, List, cast
|
||||
from typing import Any, List, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -3,8 +3,9 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections import Counter
|
||||
from collections.abc import Iterator
|
||||
import itertools
|
||||
from typing import Any, Callable, Iterator, cast
|
||||
from typing import Any, Callable, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Module that groups code required to handle state restore for component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
|
@ -1,7 +1,10 @@
|
||||
"""Define Guardian-specific utilities."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable
|
||||
from datetime import timedelta
|
||||
from typing import Awaitable, Callable
|
||||
from typing import Callable
|
||||
|
||||
from aioguardian import Client
|
||||
from aioguardian.errors import GuardianError
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Harmony data object which contains the Harmony Client."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Iterable
|
||||
|
||||
from aioharmony.const import ClientCallbackType, SendCommandDevice
|
||||
import aioharmony.exceptions as aioexc
|
||||
|
@ -1,8 +1,10 @@
|
||||
"""Denon HEOS Media Player."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from functools import reduce, wraps
|
||||
import logging
|
||||
from operator import ior
|
||||
from typing import Sequence
|
||||
|
||||
from pyheos import HeosError, const as heos_const
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import defaultdict
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime as dt, timedelta
|
||||
from itertools import groupby
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from typing import Iterable, cast
|
||||
from typing import cast
|
||||
|
||||
from aiohttp import web
|
||||
from sqlalchemy import and_, bindparam, func, not_, or_
|
||||
|
@ -1,7 +1,10 @@
|
||||
"""Decorator for view methods to help with data validation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable
|
||||
from functools import wraps
|
||||
import logging
|
||||
from typing import Any, Awaitable, Callable
|
||||
from typing import Any, Callable
|
||||
|
||||
from aiohttp import web
|
||||
import voluptuous as vol
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from bisect import bisect
|
||||
import logging
|
||||
import re
|
||||
from typing import Callable, NamedTuple, Pattern
|
||||
from typing import Callable, NamedTuple
|
||||
|
||||
import attr
|
||||
|
||||
@ -52,8 +52,8 @@ class SensorMeta(NamedTuple):
|
||||
icon: str | Callable[[StateType], str] | None = None
|
||||
unit: str | None = None
|
||||
enabled_default: bool = False
|
||||
include: Pattern[str] | None = None
|
||||
exclude: Pattern[str] | None = None
|
||||
include: re.Pattern[str] | None = None
|
||||
exclude: re.Pattern[str] | None = None
|
||||
formatter: Callable[[str], tuple[StateType, str | None]] | None = None
|
||||
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_MODE,
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""Support for Hyperion-NG remotes."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
import functools
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Callable, Mapping, Sequence
|
||||
from typing import Any, Callable
|
||||
|
||||
from hyperion import client, const
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP binary sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import BinarySensor as XknxBinarySensor
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP climate devices."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Climate as XknxClimate
|
||||
from xknx.dpt.dpt_hvac_mode import HVACControllerMode, HVACOperationMode
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Support for KNX/IP covers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Cover as XknxCover, Device as XknxDevice
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Support for KNX/IP fans."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
import math
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Fan as XknxFan
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP lights."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Light as XknxLight
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX scenes."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Scene as XknxScene
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx.devices import Sensor as XknxSensor
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP switches."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from xknx import XKNX
|
||||
from xknx.devices import Switch as XknxSwitch
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for KNX/IP weather station."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Callable
|
||||
|
||||
from xknx.devices import Weather as XknxWeather
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
SERVICE_MEDIA_PAUSE,
|
||||
|
@ -1,14 +1,13 @@
|
||||
"""Minio helper methods."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from collections.abc import Iterable, Iterator
|
||||
import json
|
||||
import logging
|
||||
from queue import Queue
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
from typing import Iterator
|
||||
from urllib.parse import unquote
|
||||
|
||||
from minio import Minio
|
||||
|
@ -3,10 +3,11 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections import defaultdict
|
||||
from collections.abc import Coroutine
|
||||
import logging
|
||||
import socket
|
||||
import sys
|
||||
from typing import Any, Callable, Coroutine
|
||||
from typing import Any, Callable
|
||||
|
||||
import async_timeout
|
||||
from mysensors import BaseAsyncGateway, Message, Sensor, mysensors
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from collections import defaultdict
|
||||
from enum import IntEnum
|
||||
import logging
|
||||
from typing import Callable, DefaultDict
|
||||
from typing import Callable
|
||||
|
||||
from mysensors import BaseAsyncGateway, Message
|
||||
from mysensors.sensor import ChildSensor
|
||||
@ -174,9 +174,9 @@ def validate_child(
|
||||
node_id: int,
|
||||
child: ChildSensor,
|
||||
value_type: int | None = None,
|
||||
) -> DefaultDict[str, list[DevId]]:
|
||||
) -> defaultdict[str, list[DevId]]:
|
||||
"""Validate a child. Returns a dict mapping hass platform names to list of DevId."""
|
||||
validated: DefaultDict[str, list[DevId]] = defaultdict(list)
|
||||
validated: defaultdict[str, list[DevId]] = defaultdict(list)
|
||||
pres: IntEnum = gateway.const.Presentation
|
||||
set_req: IntEnum = gateway.const.SetReq
|
||||
child_type_name: SensorType | None = next(
|
||||
|
@ -7,7 +7,6 @@ from functools import partial
|
||||
from itertools import islice
|
||||
import logging
|
||||
from time import time
|
||||
from typing import Deque
|
||||
|
||||
import pyatmo
|
||||
|
||||
@ -60,7 +59,7 @@ class NetatmoDataHandler:
|
||||
self.listeners: list[CALLBACK_TYPE] = []
|
||||
self._data_classes: dict = {}
|
||||
self.data = {}
|
||||
self._queue: Deque = deque()
|
||||
self._queue = deque()
|
||||
self._webhook: bool = False
|
||||
|
||||
async def async_setup(self):
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Awaitable, Callable
|
||||
from typing import Callable
|
||||
|
||||
from pynws import SimpleNWS
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
import logging
|
||||
from typing import Any, Mapping, MutableMapping
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
"""This component provides support for RainMachine programs and zones."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Coroutine
|
||||
from datetime import datetime
|
||||
from typing import Callable, Coroutine
|
||||
from typing import Callable
|
||||
|
||||
from regenmaschine.controller import Controller
|
||||
from regenmaschine.errors import RequestError
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""Support to interface with universal remote control devices."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from datetime import timedelta
|
||||
import functools as ft
|
||||
import logging
|
||||
from typing import Any, Iterable, cast, final
|
||||
from typing import Any, cast, final
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Shark IQ Wrapper."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Iterable
|
||||
|
||||
from sharkiqpy import OperatingModes, PowerModes, Properties, SharkIqVacuum
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""The sma integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
import pysma
|
||||
|
||||
@ -40,7 +41,7 @@ from .const import (
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _parse_legacy_options(entry: ConfigEntry, sensor_def: pysma.Sensors) -> List[str]:
|
||||
def _parse_legacy_options(entry: ConfigEntry, sensor_def: pysma.Sensors) -> list[str]:
|
||||
"""Parse legacy configuration options.
|
||||
|
||||
This will parse the legacy CONF_SENSORS and CONF_CUSTOM configuration options
|
||||
@ -89,7 +90,7 @@ def _migrate_old_unique_ids(
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
sensor_def: pysma.Sensors,
|
||||
config_sensors: List[str],
|
||||
config_sensors: list[str],
|
||||
) -> None:
|
||||
"""Migrate legacy sensor entity_id format to new format."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""SMA Solar Webconnect interface."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Coroutine
|
||||
import logging
|
||||
from typing import Any, Callable, Coroutine
|
||||
from typing import Any, Callable
|
||||
|
||||
import pysma
|
||||
import voluptuous as vol
|
||||
|
@ -1,8 +1,10 @@
|
||||
"""Support for SmartThings Cloud."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import importlib
|
||||
import logging
|
||||
from typing import Iterable
|
||||
|
||||
from aiohttp.client_exceptions import ClientConnectionError, ClientResponseError
|
||||
from pysmartapp.event import EVENT_TYPE_DEVICE
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for binary sensors through the SmartThings cloud API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
from collections.abc import Iterable, Sequence
|
||||
import logging
|
||||
from typing import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for covers through the SmartThings cloud API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Support for fans through the SmartThings cloud API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
import math
|
||||
from typing import Sequence
|
||||
|
||||
from pysmartthings import Capability
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Capability
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for locks through the SmartThings cloud API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import namedtuple
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for switches through the SmartThings cloud API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence
|
||||
from collections.abc import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Iterable
|
||||
from datetime import date, datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from requests.exceptions import ConnectTimeout, HTTPError
|
||||
from solaredge import Solaredge
|
||||
|
@ -2,12 +2,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Coroutine
|
||||
from contextlib import suppress
|
||||
import datetime
|
||||
import functools as ft
|
||||
import logging
|
||||
import socket
|
||||
from typing import Any, Callable, Coroutine
|
||||
from typing import Any, Callable
|
||||
import urllib.parse
|
||||
|
||||
import async_timeout
|
||||
|
@ -1,8 +1,11 @@
|
||||
"""The SSDP integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, Mapping
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
from async_upnp_client.search import async_search
|
||||
|
@ -1,10 +1,10 @@
|
||||
"""Provide functionality to record stream."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import deque
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from typing import Deque
|
||||
|
||||
import av
|
||||
|
||||
@ -21,7 +21,7 @@ def async_setup_recorder(hass):
|
||||
"""Only here so Provider Registry works."""
|
||||
|
||||
|
||||
def recorder_save_worker(file_out: str, segments: Deque[Segment]):
|
||||
def recorder_save_worker(file_out: str, segments: deque[Segment]):
|
||||
"""Handle saving stream."""
|
||||
|
||||
if not segments:
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Light support for switch entities."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Sequence, cast
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, Callable, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,10 +2,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable
|
||||
import dataclasses
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from typing import Awaitable, Callable
|
||||
from typing import Callable
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""Support for script and automation tracing and debugging."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import deque
|
||||
import datetime as dt
|
||||
from itertools import count
|
||||
from typing import Any, Deque
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.helpers.trace import (
|
||||
@ -52,7 +53,7 @@ class ActionTrace:
|
||||
context: Context,
|
||||
):
|
||||
"""Container for script trace."""
|
||||
self._trace: dict[str, Deque[TraceElement]] | None = None
|
||||
self._trace: dict[str, deque[TraceElement]] | None = None
|
||||
self._config: dict[str, Any] = config
|
||||
self._blueprint_inputs: dict[str, Any] = blueprint_inputs
|
||||
self.context: Context = context
|
||||
@ -67,7 +68,7 @@ class ActionTrace:
|
||||
trace_set_child_id(self.key, self.run_id)
|
||||
trace_id_set((key, self.run_id))
|
||||
|
||||
def set_trace(self, trace: dict[str, Deque[TraceElement]]) -> None:
|
||||
def set_trace(self, trace: dict[str, deque[TraceElement]]) -> None:
|
||||
"""Set trace."""
|
||||
self._trace = trace
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Config flow for UPNP."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from datetime import timedelta
|
||||
from typing import Any, Mapping
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
from ipaddress import IPv4Address
|
||||
from typing import Mapping
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from async_upnp_client import UpnpFactory
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Common vera code."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import DefaultDict, NamedTuple
|
||||
from collections import defaultdict
|
||||
from typing import NamedTuple
|
||||
|
||||
import pyvera as pv
|
||||
|
||||
@ -17,7 +18,7 @@ class ControllerData(NamedTuple):
|
||||
"""Controller data."""
|
||||
|
||||
controller: pv.VeraController
|
||||
devices: DefaultDict[str, list[pv.VeraDevice]]
|
||||
devices: defaultdict[str, list[pv.VeraDevice]]
|
||||
scenes: list[pv.VeraScene]
|
||||
config_entry: ConfigEntry
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
FORMAT_NUMBER,
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for Verisure binary sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_CONNECTIVITY,
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""Support for Verisure cameras."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
import errno
|
||||
import os
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from verisure import Error as VerisureError
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from verisure import Error as VerisureError
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
"""Support for Verisure sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Support for Verisure Smartplugs."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from time import monotonic
|
||||
from typing import Any, Callable, Iterable
|
||||
from typing import Any, Callable
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -2,8 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import logging
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Callable, Hashable
|
||||
from collections.abc import Hashable
|
||||
from typing import Any, Callable
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
"""Decorators for the Websocket API."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable
|
||||
from functools import wraps
|
||||
from typing import Awaitable, Callable
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import Unauthorized
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Generator
|
||||
import contextlib
|
||||
import logging
|
||||
from typing import Any, Generator
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
from pywemo import WeMoDevice
|
||||
|
@ -1,7 +1,10 @@
|
||||
"""Xbox Remote support."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
import re
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
|
||||
from xbox.webapi.api.client import XboxLiveClient
|
||||
from xbox.webapi.api.provider.smartglass.models import (
|
||||
|
@ -2,7 +2,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Coroutine
|
||||
from collections.abc import Coroutine
|
||||
from typing import Any
|
||||
|
||||
import zigpy.exceptions
|
||||
import zigpy.zcl.clusters.general as general
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Home automation channels module for Zigbee Home Automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Coroutine
|
||||
from collections.abc import Coroutine
|
||||
|
||||
import zigpy.zcl.clusters.homeautomation as homeautomation
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Lighting channels module for Zigbee Home Automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Coroutine
|
||||
from contextlib import suppress
|
||||
from typing import Coroutine
|
||||
|
||||
import zigpy.zcl.clusters.lighting as lighting
|
||||
|
||||
|
@ -4,8 +4,10 @@ Security channels module for Zigbee Home Automation.
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/integrations/zha/
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Coroutine
|
||||
from collections.abc import Coroutine
|
||||
|
||||
from zigpy.exceptions import ZigbeeException
|
||||
import zigpy.zcl.clusters.security as security
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Smart energy channels module for Zigbee Home Automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Coroutine
|
||||
from collections.abc import Coroutine
|
||||
|
||||
import zigpy.zcl.clusters.smartenergy as smartenergy
|
||||
|
||||
|
@ -8,13 +8,14 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import binascii
|
||||
from collections.abc import Iterator
|
||||
from dataclasses import dataclass
|
||||
import functools
|
||||
import itertools
|
||||
import logging
|
||||
from random import uniform
|
||||
import re
|
||||
from typing import Any, Callable, Iterator
|
||||
from typing import Any, Callable
|
||||
|
||||
import voluptuous as vol
|
||||
import zigpy.exceptions
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import OrderedDict
|
||||
from collections.abc import MutableMapping
|
||||
import datetime
|
||||
import time
|
||||
from typing import MutableMapping, cast
|
||||
from typing import cast
|
||||
|
||||
import attr
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable
|
||||
import functools
|
||||
import logging
|
||||
from typing import Any, Awaitable
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.core import CALLBACK_TYPE, Event, callback
|
||||
|
@ -1,8 +1,9 @@
|
||||
"""Map Z-Wave nodes and values to Home Assistant entities."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Generator
|
||||
from typing import Any
|
||||
|
||||
from zwave_js_server.const import CommandClass
|
||||
from zwave_js_server.model.device_class import DeviceClassItem
|
||||
|
@ -2,13 +2,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Sequence
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Sequence
|
||||
from typing import Any, Callable
|
||||
|
||||
from awesomeversion import AwesomeVersion
|
||||
import voluptuous as vol
|
||||
|
@ -7,6 +7,7 @@ of entities and react to changes.
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Collection, Iterable, Mapping
|
||||
import datetime
|
||||
import enum
|
||||
import functools
|
||||
@ -17,19 +18,7 @@ import re
|
||||
import threading
|
||||
from time import monotonic
|
||||
from types import MappingProxyType
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Awaitable,
|
||||
Callable,
|
||||
Collection,
|
||||
Coroutine,
|
||||
Iterable,
|
||||
Mapping,
|
||||
Optional,
|
||||
TypeVar,
|
||||
cast,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Optional, TypeVar, cast
|
||||
|
||||
import attr
|
||||
import voluptuous as vol
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user