From 364767ff22f6ea53630998d0615c44b9f2f0ae4a Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 29 Sep 2021 16:15:36 +0200 Subject: [PATCH] Import Callable from collections.abc (4) (#56778) --- homeassistant/components/daikin/sensor.py | 2 +- homeassistant/components/denonavr/receiver.py | 2 +- homeassistant/components/device_tracker/legacy.py | 4 ++-- homeassistant/components/dynalite/bridge.py | 3 ++- homeassistant/components/dynalite/dynalitebase.py | 3 ++- homeassistant/components/forecast_solar/models.py | 3 ++- homeassistant/components/group/media_player.py | 3 ++- homeassistant/components/group/util.py | 4 ++-- homeassistant/components/iotawatt/sensor.py | 2 +- homeassistant/components/iqvia/__init__.py | 4 ++-- homeassistant/components/knx/cover.py | 3 ++- homeassistant/components/knx/expose.py | 2 +- homeassistant/components/lyric/sensor.py | 5 ++++- homeassistant/components/mqtt/debug_info.py | 5 ++++- homeassistant/components/mqtt/device_trigger.py | 3 ++- homeassistant/components/mqtt/mixins.py | 2 +- homeassistant/components/mqtt/subscription.py | 3 ++- homeassistant/components/nest/camera_sdm.py | 3 ++- homeassistant/components/onvif/event.py | 2 +- homeassistant/components/sensor/recorder.py | 2 +- homeassistant/components/system_bridge/binary_sensor.py | 2 +- homeassistant/components/system_bridge/coordinator.py | 2 +- homeassistant/components/system_bridge/sensor.py | 3 ++- homeassistant/components/tasmota/binary_sensor.py | 3 ++- homeassistant/components/tasmota/device_trigger.py | 3 ++- homeassistant/components/tod/binary_sensor.py | 4 +++- homeassistant/components/webhook/__init__.py | 3 +-- homeassistant/components/wled/coordinator.py | 2 +- 28 files changed, 50 insertions(+), 32 deletions(-) diff --git a/homeassistant/components/daikin/sensor.py b/homeassistant/components/daikin/sensor.py index 1b590b261b7..62d3e8e1f7e 100644 --- a/homeassistant/components/daikin/sensor.py +++ b/homeassistant/components/daikin/sensor.py @@ -1,8 +1,8 @@ """Support for Daikin AC sensors.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass -from typing import Callable from pydaikin.daikin_base import Appliance diff --git a/homeassistant/components/denonavr/receiver.py b/homeassistant/components/denonavr/receiver.py index a35b6c80fcd..5c15468e6d4 100644 --- a/homeassistant/components/denonavr/receiver.py +++ b/homeassistant/components/denonavr/receiver.py @@ -1,8 +1,8 @@ """Code to handle a DenonAVR receiver.""" from __future__ import annotations +from collections.abc import Callable import logging -from typing import Callable from denonavr import DenonAVR diff --git a/homeassistant/components/device_tracker/legacy.py b/homeassistant/components/device_tracker/legacy.py index 991a4bb7bb1..31d060200f0 100644 --- a/homeassistant/components/device_tracker/legacy.py +++ b/homeassistant/components/device_tracker/legacy.py @@ -2,11 +2,11 @@ from __future__ import annotations import asyncio -from collections.abc import Coroutine, Sequence +from collections.abc import Callable, Coroutine, Sequence from datetime import timedelta import hashlib from types import ModuleType -from typing import Any, Callable, Final, final +from typing import Any, Final, final import attr import voluptuous as vol diff --git a/homeassistant/components/dynalite/bridge.py b/homeassistant/components/dynalite/bridge.py index 9c911e6983d..82666f20a40 100644 --- a/homeassistant/components/dynalite/bridge.py +++ b/homeassistant/components/dynalite/bridge.py @@ -1,8 +1,9 @@ """Code to handle a Dynalite bridge.""" from __future__ import annotations +from collections.abc import Callable from types import MappingProxyType -from typing import Any, Callable +from typing import Any from dynalite_devices_lib.dynalite_devices import ( CONF_AREA as dyn_CONF_AREA, diff --git a/homeassistant/components/dynalite/dynalitebase.py b/homeassistant/components/dynalite/dynalitebase.py index 56def12afbe..72803f86f02 100644 --- a/homeassistant/components/dynalite/dynalitebase.py +++ b/homeassistant/components/dynalite/dynalitebase.py @@ -1,7 +1,8 @@ """Support for the Dynalite devices as entities.""" from __future__ import annotations -from typing import Any, Callable +from collections.abc import Callable +from typing import Any from homeassistant.components.dynalite.bridge import DynaliteBridge from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/forecast_solar/models.py b/homeassistant/components/forecast_solar/models.py index 6bcc97d49f2..af9b6125713 100644 --- a/homeassistant/components/forecast_solar/models.py +++ b/homeassistant/components/forecast_solar/models.py @@ -1,8 +1,9 @@ """Models for the Forecast.Solar integration.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass -from typing import Any, Callable +from typing import Any from forecast_solar.models import Estimate diff --git a/homeassistant/components/group/media_player.py b/homeassistant/components/group/media_player.py index b7db9fa9631..844e6e3799f 100644 --- a/homeassistant/components/group/media_player.py +++ b/homeassistant/components/group/media_player.py @@ -1,7 +1,8 @@ """This platform allows several media players to be grouped into one media player.""" from __future__ import annotations -from typing import Any, Callable +from collections.abc import Callable +from typing import Any import voluptuous as vol diff --git a/homeassistant/components/group/util.py b/homeassistant/components/group/util.py index 7e284691049..0944ceb6745 100644 --- a/homeassistant/components/group/util.py +++ b/homeassistant/components/group/util.py @@ -1,9 +1,9 @@ """Utility functions to combine state attributes from multiple entities.""" from __future__ import annotations -from collections.abc import Iterator +from collections.abc import Callable, Iterator from itertools import groupby -from typing import Any, Callable +from typing import Any from homeassistant.core import State diff --git a/homeassistant/components/iotawatt/sensor.py b/homeassistant/components/iotawatt/sensor.py index c52f8cb9189..ba0ec30caa0 100644 --- a/homeassistant/components/iotawatt/sensor.py +++ b/homeassistant/components/iotawatt/sensor.py @@ -1,9 +1,9 @@ """Support for IoTaWatt Energy monitor.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass import logging -from typing import Callable from iotawattpy.sensor import Sensor diff --git a/homeassistant/components/iqvia/__init__.py b/homeassistant/components/iqvia/__init__.py index 5a7fa682bc1..0a782669846 100644 --- a/homeassistant/components/iqvia/__init__.py +++ b/homeassistant/components/iqvia/__init__.py @@ -2,10 +2,10 @@ from __future__ import annotations import asyncio -from collections.abc import Awaitable +from collections.abc import Awaitable, Callable from datetime import timedelta from functools import partial -from typing import Any, Callable, Dict, cast +from typing import Any, Dict, cast from pyiqvia import Client from pyiqvia.errors import IQVIAError diff --git a/homeassistant/components/knx/cover.py b/homeassistant/components/knx/cover.py index 5d32726474c..85cd6c9a60f 100644 --- a/homeassistant/components/knx/cover.py +++ b/homeassistant/components/knx/cover.py @@ -1,8 +1,9 @@ """Support for KNX/IP covers.""" from __future__ import annotations +from collections.abc import Callable from datetime import datetime -from typing import Any, Callable +from typing import Any from xknx import XKNX from xknx.devices import Cover as XknxCover, Device as XknxDevice diff --git a/homeassistant/components/knx/expose.py b/homeassistant/components/knx/expose.py index 408ab25e7cc..b4b15c977fd 100644 --- a/homeassistant/components/knx/expose.py +++ b/homeassistant/components/knx/expose.py @@ -1,7 +1,7 @@ """Exposures to KNX bus.""" from __future__ import annotations -from typing import Callable +from collections.abc import Callable from xknx import XKNX from xknx.devices import DateTime, ExposeSensor diff --git a/homeassistant/components/lyric/sensor.py b/homeassistant/components/lyric/sensor.py index b5b0ffdeb3d..6f550813ad8 100644 --- a/homeassistant/components/lyric/sensor.py +++ b/homeassistant/components/lyric/sensor.py @@ -1,7 +1,10 @@ """Support for Honeywell Lyric sensor platform.""" +from __future__ import annotations + +from collections.abc import Callable from dataclasses import dataclass from datetime import datetime, timedelta -from typing import Callable, cast +from typing import cast from aiolyric.objects.device import LyricDevice from aiolyric.objects.location import LyricLocation diff --git a/homeassistant/components/mqtt/debug_info.py b/homeassistant/components/mqtt/debug_info.py index 57cb88e65e3..f9bb3f1c91f 100644 --- a/homeassistant/components/mqtt/debug_info.py +++ b/homeassistant/components/mqtt/debug_info.py @@ -1,7 +1,10 @@ """Helper to handle a set of topics to subscribe to.""" +from __future__ import annotations + from collections import deque +from collections.abc import Callable from functools import wraps -from typing import Any, Callable +from typing import Any from homeassistant.core import HomeAssistant diff --git a/homeassistant/components/mqtt/device_trigger.py b/homeassistant/components/mqtt/device_trigger.py index 6348156ef50..fe1bd608305 100644 --- a/homeassistant/components/mqtt/device_trigger.py +++ b/homeassistant/components/mqtt/device_trigger.py @@ -1,8 +1,9 @@ """Provides device automations for MQTT.""" from __future__ import annotations +from collections.abc import Callable import logging -from typing import Any, Callable +from typing import Any import attr import voluptuous as vol diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 11bf70ceceb..e21f3f5c280 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -2,9 +2,9 @@ from __future__ import annotations from abc import abstractmethod +from collections.abc import Callable import json import logging -from typing import Callable import voluptuous as vol diff --git a/homeassistant/components/mqtt/subscription.py b/homeassistant/components/mqtt/subscription.py index 03259a37380..6d132b28a98 100644 --- a/homeassistant/components/mqtt/subscription.py +++ b/homeassistant/components/mqtt/subscription.py @@ -1,7 +1,8 @@ """Helper to handle a set of topics to subscribe to.""" from __future__ import annotations -from typing import Any, Callable +from collections.abc import Callable +from typing import Any import attr diff --git a/homeassistant/components/nest/camera_sdm.py b/homeassistant/components/nest/camera_sdm.py index 07a75129b44..0a917e8cbdc 100644 --- a/homeassistant/components/nest/camera_sdm.py +++ b/homeassistant/components/nest/camera_sdm.py @@ -1,9 +1,10 @@ """Support for Google Nest SDM Cameras.""" from __future__ import annotations +from collections.abc import Callable import datetime import logging -from typing import Any, Callable +from typing import Any from google_nest_sdm.camera_traits import ( CameraEventImageTrait, diff --git a/homeassistant/components/onvif/event.py b/homeassistant/components/onvif/event.py index a45cc02c84b..f76efb2bc8e 100644 --- a/homeassistant/components/onvif/event.py +++ b/homeassistant/components/onvif/event.py @@ -2,9 +2,9 @@ from __future__ import annotations import asyncio +from collections.abc import Callable from contextlib import suppress import datetime as dt -from typing import Callable from httpx import RemoteProtocolError, TransportError from onvif import ONVIFCamera, ONVIFService diff --git a/homeassistant/components/sensor/recorder.py b/homeassistant/components/sensor/recorder.py index 806981d51eb..b8499bc8040 100644 --- a/homeassistant/components/sensor/recorder.py +++ b/homeassistant/components/sensor/recorder.py @@ -2,11 +2,11 @@ from __future__ import annotations from collections import defaultdict +from collections.abc import Callable import datetime import itertools import logging import math -from typing import Callable from homeassistant.components.recorder import history, statistics from homeassistant.components.recorder.models import ( diff --git a/homeassistant/components/system_bridge/binary_sensor.py b/homeassistant/components/system_bridge/binary_sensor.py index 0587ec3629c..a622a3a925a 100644 --- a/homeassistant/components/system_bridge/binary_sensor.py +++ b/homeassistant/components/system_bridge/binary_sensor.py @@ -1,8 +1,8 @@ """Support for System Bridge binary sensors.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass -from typing import Callable from systembridge import Bridge diff --git a/homeassistant/components/system_bridge/coordinator.py b/homeassistant/components/system_bridge/coordinator.py index 177a09e5d25..fb0b63c715a 100644 --- a/homeassistant/components/system_bridge/coordinator.py +++ b/homeassistant/components/system_bridge/coordinator.py @@ -2,9 +2,9 @@ from __future__ import annotations import asyncio +from collections.abc import Callable from datetime import timedelta import logging -from typing import Callable from systembridge import Bridge from systembridge.exceptions import ( diff --git a/homeassistant/components/system_bridge/sensor.py b/homeassistant/components/system_bridge/sensor.py index 720bfc78a72..3e8d2aa7ff0 100644 --- a/homeassistant/components/system_bridge/sensor.py +++ b/homeassistant/components/system_bridge/sensor.py @@ -1,9 +1,10 @@ """Support for System Bridge sensors.""" from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass from datetime import datetime, timedelta -from typing import Callable, Final, cast +from typing import Final, cast from systembridge import Bridge diff --git a/homeassistant/components/tasmota/binary_sensor.py b/homeassistant/components/tasmota/binary_sensor.py index 1ccee0bf7d3..a0f4dfff5ac 100644 --- a/homeassistant/components/tasmota/binary_sensor.py +++ b/homeassistant/components/tasmota/binary_sensor.py @@ -1,8 +1,9 @@ """Support for Tasmota binary sensors.""" from __future__ import annotations +from collections.abc import Callable from datetime import datetime -from typing import Any, Callable +from typing import Any from hatasmota import switch as tasmota_switch from hatasmota.entity import TasmotaEntity as HATasmotaEntity diff --git a/homeassistant/components/tasmota/device_trigger.py b/homeassistant/components/tasmota/device_trigger.py index 27bcc4228ea..61efbb76e23 100644 --- a/homeassistant/components/tasmota/device_trigger.py +++ b/homeassistant/components/tasmota/device_trigger.py @@ -1,8 +1,9 @@ """Provides device automations for Tasmota.""" from __future__ import annotations +from collections.abc import Callable import logging -from typing import Any, Callable +from typing import Any import attr from hatasmota.models import DiscoveryHashType diff --git a/homeassistant/components/tod/binary_sensor.py b/homeassistant/components/tod/binary_sensor.py index 8264468e2e7..3cf74a4c1f4 100644 --- a/homeassistant/components/tod/binary_sensor.py +++ b/homeassistant/components/tod/binary_sensor.py @@ -1,7 +1,9 @@ """Support for representing current time of the day as binary sensors.""" +from __future__ import annotations + +from collections.abc import Callable from datetime import datetime, timedelta import logging -from typing import Callable import voluptuous as vol diff --git a/homeassistant/components/webhook/__init__.py b/homeassistant/components/webhook/__init__.py index cc0d8db1407..656f12950ea 100644 --- a/homeassistant/components/webhook/__init__.py +++ b/homeassistant/components/webhook/__init__.py @@ -1,10 +1,9 @@ """Webhooks for Home Assistant.""" from __future__ import annotations -from collections.abc import Awaitable +from collections.abc import Awaitable, Callable import logging import secrets -from typing import Callable from aiohttp.web import Request, Response import voluptuous as vol diff --git a/homeassistant/components/wled/coordinator.py b/homeassistant/components/wled/coordinator.py index b730ac1543a..06c1f8b5dc3 100644 --- a/homeassistant/components/wled/coordinator.py +++ b/homeassistant/components/wled/coordinator.py @@ -2,7 +2,7 @@ from __future__ import annotations import asyncio -from typing import Callable +from collections.abc import Callable from wled import WLED, Device as WLEDDevice, WLEDConnectionClosed, WLEDError