diff --git a/homeassistant/components/alarm_control_panel/group.py b/homeassistant/components/alarm_control_panel/group.py index 3ef1ff96cda..e0806822cef 100644 --- a/homeassistant/components/alarm_control_panel/group.py +++ b/homeassistant/components/alarm_control_panel/group.py @@ -1,6 +1,5 @@ """Describe group states.""" - from typing import TYPE_CHECKING from homeassistant.const import ( diff --git a/homeassistant/components/config/category_registry.py b/homeassistant/components/config/category_registry.py index 045243a355b..5fc705a5844 100644 --- a/homeassistant/components/config/category_registry.py +++ b/homeassistant/components/config/category_registry.py @@ -1,4 +1,5 @@ """Websocket API to interact with the category registry.""" + from typing import Any import voluptuous as vol diff --git a/homeassistant/components/control4/media_player.py b/homeassistant/components/control4/media_player.py index c65004260af..99d8c27face 100644 --- a/homeassistant/components/control4/media_player.py +++ b/homeassistant/components/control4/media_player.py @@ -1,4 +1,5 @@ """Platform for Control4 Rooms Media Players.""" + from __future__ import annotations from dataclasses import dataclass diff --git a/homeassistant/components/downloader/config_flow.py b/homeassistant/components/downloader/config_flow.py index 70557d30e19..69393c04985 100644 --- a/homeassistant/components/downloader/config_flow.py +++ b/homeassistant/components/downloader/config_flow.py @@ -1,4 +1,5 @@ """Config flow for Downloader integration.""" + from __future__ import annotations import os diff --git a/homeassistant/components/downloader/const.py b/homeassistant/components/downloader/const.py index 047dff2b0cc..14160e4cd5d 100644 --- a/homeassistant/components/downloader/const.py +++ b/homeassistant/components/downloader/const.py @@ -1,4 +1,5 @@ """Constants for the Downloader component.""" + import logging _LOGGER = logging.getLogger(__package__) diff --git a/homeassistant/components/esphome/date.py b/homeassistant/components/esphome/date.py index dbfc7779824..9998eea1a5d 100644 --- a/homeassistant/components/esphome/date.py +++ b/homeassistant/components/esphome/date.py @@ -1,4 +1,5 @@ """Support for esphome dates.""" + from __future__ import annotations from datetime import date diff --git a/homeassistant/components/esphome/time.py b/homeassistant/components/esphome/time.py index b68decd4252..de985a1e1d6 100644 --- a/homeassistant/components/esphome/time.py +++ b/homeassistant/components/esphome/time.py @@ -1,4 +1,5 @@ """Support for esphome times.""" + from __future__ import annotations from datetime import time diff --git a/homeassistant/components/fyta/__init__.py b/homeassistant/components/fyta/__init__.py index 34399ce23ee..febd5b94469 100644 --- a/homeassistant/components/fyta/__init__.py +++ b/homeassistant/components/fyta/__init__.py @@ -1,4 +1,5 @@ """Initialization of FYTA integration.""" + from __future__ import annotations import logging diff --git a/homeassistant/components/fyta/config_flow.py b/homeassistant/components/fyta/config_flow.py index 698686a41a7..67e46f8125e 100644 --- a/homeassistant/components/fyta/config_flow.py +++ b/homeassistant/components/fyta/config_flow.py @@ -1,4 +1,5 @@ """Config flow for FYTA integration.""" + from __future__ import annotations import logging diff --git a/homeassistant/components/fyta/const.py b/homeassistant/components/fyta/const.py index 86c3121089d..f99735dc6fa 100644 --- a/homeassistant/components/fyta/const.py +++ b/homeassistant/components/fyta/const.py @@ -1,2 +1,3 @@ """Const for fyta integration.""" + DOMAIN = "fyta" diff --git a/homeassistant/components/fyta/entity.py b/homeassistant/components/fyta/entity.py index a0bcf0a0084..681a50f4cf5 100644 --- a/homeassistant/components/fyta/entity.py +++ b/homeassistant/components/fyta/entity.py @@ -1,4 +1,5 @@ """Entities for FYTA integration.""" + from typing import Any from homeassistant.components.sensor import SensorEntityDescription diff --git a/homeassistant/components/fyta/sensor.py b/homeassistant/components/fyta/sensor.py index ae1c1bec272..0643c69981e 100644 --- a/homeassistant/components/fyta/sensor.py +++ b/homeassistant/components/fyta/sensor.py @@ -1,4 +1,5 @@ """Summary data from Fyta.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/components/homeworks/binary_sensor.py b/homeassistant/components/homeworks/binary_sensor.py index a4d315b6821..9773411d26d 100644 --- a/homeassistant/components/homeworks/binary_sensor.py +++ b/homeassistant/components/homeworks/binary_sensor.py @@ -1,4 +1,5 @@ """Support for Lutron Homeworks binary sensors.""" + from __future__ import annotations import logging diff --git a/homeassistant/components/husqvarna_automower/diagnostics.py b/homeassistant/components/husqvarna_automower/diagnostics.py index 7a715292a07..f5677d4cb4b 100644 --- a/homeassistant/components/husqvarna_automower/diagnostics.py +++ b/homeassistant/components/husqvarna_automower/diagnostics.py @@ -1,4 +1,5 @@ """Diagnostics support for Husqvarna Automower.""" + from __future__ import annotations import logging diff --git a/homeassistant/components/ipma/diagnostics.py b/homeassistant/components/ipma/diagnostics.py index 30c22d6481a..948b69ee3e5 100644 --- a/homeassistant/components/ipma/diagnostics.py +++ b/homeassistant/components/ipma/diagnostics.py @@ -1,4 +1,5 @@ """Diagnostics support for IPMA.""" + from __future__ import annotations from typing import Any diff --git a/homeassistant/components/lupusec/config_flow.py b/homeassistant/components/lupusec/config_flow.py index 4129c33eabf..c3fe7295266 100644 --- a/homeassistant/components/lupusec/config_flow.py +++ b/homeassistant/components/lupusec/config_flow.py @@ -1,4 +1,4 @@ -""""Config flow for Lupusec integration.""" +"""Config flow for Lupusec integration.""" from json import JSONDecodeError import logging diff --git a/homeassistant/components/map/__init__.py b/homeassistant/components/map/__init__.py index beddde5df1d..25095e92b93 100644 --- a/homeassistant/components/map/__init__.py +++ b/homeassistant/components/map/__init__.py @@ -1,4 +1,5 @@ """Support for showing device locations.""" + from homeassistant.components import onboarding from homeassistant.components.lovelace import _create_map_dashboard from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant diff --git a/homeassistant/components/microbees/binary_sensor.py b/homeassistant/components/microbees/binary_sensor.py index 929aae52490..551f68ba354 100644 --- a/homeassistant/components/microbees/binary_sensor.py +++ b/homeassistant/components/microbees/binary_sensor.py @@ -1,4 +1,5 @@ """BinarySensor integration microBees.""" + from microBeesPy import Sensor from homeassistant.components.binary_sensor import ( diff --git a/homeassistant/components/microbees/cover.py b/homeassistant/components/microbees/cover.py index 5caf57403de..bdf6e815af1 100644 --- a/homeassistant/components/microbees/cover.py +++ b/homeassistant/components/microbees/cover.py @@ -1,4 +1,5 @@ """Cover integration microBees.""" + from typing import Any from microBeesPy import Actuator diff --git a/homeassistant/components/minecraft_server/binary_sensor.py b/homeassistant/components/minecraft_server/binary_sensor.py index de514754ef8..60f2e00da0e 100644 --- a/homeassistant/components/minecraft_server/binary_sensor.py +++ b/homeassistant/components/minecraft_server/binary_sensor.py @@ -1,6 +1,5 @@ """The Minecraft Server binary sensor platform.""" - from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, diff --git a/homeassistant/components/ring/entity.py b/homeassistant/components/ring/entity.py index 0c738090218..fb617ecd7d1 100644 --- a/homeassistant/components/ring/entity.py +++ b/homeassistant/components/ring/entity.py @@ -1,4 +1,5 @@ """Base class for Ring entity.""" + from collections.abc import Callable from typing import Any, Concatenate, ParamSpec, TypeVar diff --git a/homeassistant/components/unifi/hub/entity_loader.py b/homeassistant/components/unifi/hub/entity_loader.py index 2ed2c09d049..30b5ba6e686 100644 --- a/homeassistant/components/unifi/hub/entity_loader.py +++ b/homeassistant/components/unifi/hub/entity_loader.py @@ -3,6 +3,7 @@ Central point to load entities for the different platforms. Make sure expected clients are available for platforms. """ + from __future__ import annotations import asyncio diff --git a/homeassistant/components/webmin/diagnostics.py b/homeassistant/components/webmin/diagnostics.py index 86e2c9eef62..390db73814a 100644 --- a/homeassistant/components/webmin/diagnostics.py +++ b/homeassistant/components/webmin/diagnostics.py @@ -1,4 +1,5 @@ """Diagnostics support for Webmin.""" + from typing import Any from homeassistant.components.diagnostics import async_redact_data diff --git a/homeassistant/helpers/category_registry.py b/homeassistant/helpers/category_registry.py index 686ddaa69c8..ee0c8c1bb88 100644 --- a/homeassistant/helpers/category_registry.py +++ b/homeassistant/helpers/category_registry.py @@ -1,4 +1,5 @@ """Provide a way to categorize things within a defined scope.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/tests/components/anova/__init__.py b/tests/components/anova/__init__.py index aa58ee5bbb5..fb4c578ba1b 100644 --- a/tests/components/anova/__init__.py +++ b/tests/components/anova/__init__.py @@ -1,4 +1,5 @@ """Tests for the Anova integration.""" + from __future__ import annotations from unittest.mock import patch diff --git a/tests/components/button/conftest.py b/tests/components/button/conftest.py index fa7b153def5..75d5509efc9 100644 --- a/tests/components/button/conftest.py +++ b/tests/components/button/conftest.py @@ -1,4 +1,5 @@ """Fixtures for the button entity component tests.""" + import logging import pytest diff --git a/tests/components/button/test_init.py b/tests/components/button/test_init.py index caddfe93814..0641bbe29dc 100644 --- a/tests/components/button/test_init.py +++ b/tests/components/button/test_init.py @@ -1,4 +1,5 @@ """The tests for the Button component.""" + from collections.abc import Generator from datetime import timedelta from unittest.mock import MagicMock diff --git a/tests/components/config/test_category_registry.py b/tests/components/config/test_category_registry.py index fd762d80c3b..b4d171535b6 100644 --- a/tests/components/config/test_category_registry.py +++ b/tests/components/config/test_category_registry.py @@ -1,4 +1,5 @@ """Test category registry API.""" + import pytest from homeassistant.components.config import category_registry diff --git a/tests/components/downloader/test_config_flow.py b/tests/components/downloader/test_config_flow.py index 597ecb333bf..53c1be69830 100644 --- a/tests/components/downloader/test_config_flow.py +++ b/tests/components/downloader/test_config_flow.py @@ -1,4 +1,5 @@ """Test the Downloader config flow.""" + from unittest.mock import patch import pytest diff --git a/tests/components/event/conftest.py b/tests/components/event/conftest.py index 38c59af117b..2b4a2dbba45 100644 --- a/tests/components/event/conftest.py +++ b/tests/components/event/conftest.py @@ -1,4 +1,5 @@ """Fixtures for the event entity component tests.""" + import logging import pytest diff --git a/tests/components/flux_led/test_number.py b/tests/components/flux_led/test_number.py index 8858e7c7c93..455bad05029 100644 --- a/tests/components/flux_led/test_number.py +++ b/tests/components/flux_led/test_number.py @@ -1,6 +1,5 @@ """Tests for the flux_led number platform.""" - from datetime import timedelta from flux_led.const import COLOR_MODE_RGB as FLUX_COLOR_MODE_RGB diff --git a/tests/components/fyta/conftest.py b/tests/components/fyta/conftest.py index 40ab4925a47..e35012a02e8 100644 --- a/tests/components/fyta/conftest.py +++ b/tests/components/fyta/conftest.py @@ -1,4 +1,5 @@ """Test helpers.""" + from collections.abc import Generator from unittest.mock import AsyncMock, patch diff --git a/tests/components/fyta/test_config_flow.py b/tests/components/fyta/test_config_flow.py index 1fdb9b6109c..b21be5abb90 100644 --- a/tests/components/fyta/test_config_flow.py +++ b/tests/components/fyta/test_config_flow.py @@ -1,4 +1,5 @@ """Test the fyta config flow.""" + from datetime import datetime from unittest.mock import AsyncMock diff --git a/tests/components/homeworks/test_binary_sensor.py b/tests/components/homeworks/test_binary_sensor.py index cc9e580c23c..0b21ae3b773 100644 --- a/tests/components/homeworks/test_binary_sensor.py +++ b/tests/components/homeworks/test_binary_sensor.py @@ -1,4 +1,5 @@ """Tests for the Lutron Homeworks Series 4 and 8 binary sensor.""" + from unittest.mock import ANY, MagicMock from freezegun.api import FrozenDateTimeFactory diff --git a/tests/components/homeworks/test_button.py b/tests/components/homeworks/test_button.py index 6f0250d980a..1bf4f93e49a 100644 --- a/tests/components/homeworks/test_button.py +++ b/tests/components/homeworks/test_button.py @@ -1,4 +1,5 @@ """Tests for the Lutron Homeworks Series 4 and 8 button.""" + from unittest.mock import MagicMock from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS diff --git a/tests/components/homeworks/test_init.py b/tests/components/homeworks/test_init.py index a3eb864c9da..566e0b4beb4 100644 --- a/tests/components/homeworks/test_init.py +++ b/tests/components/homeworks/test_init.py @@ -1,4 +1,5 @@ """Tests for the Lutron Homeworks Series 4 and 8 integration.""" + from unittest.mock import ANY, MagicMock from pyhomeworks.pyhomeworks import HW_BUTTON_PRESSED, HW_BUTTON_RELEASED diff --git a/tests/components/homeworks/test_light.py b/tests/components/homeworks/test_light.py index dda88f2a784..a5d94f736d5 100644 --- a/tests/components/homeworks/test_light.py +++ b/tests/components/homeworks/test_light.py @@ -1,4 +1,5 @@ """Tests for the Lutron Homeworks Series 4 and 8 light.""" + from unittest.mock import ANY, MagicMock from pyhomeworks.pyhomeworks import HW_LIGHT_CHANGED diff --git a/tests/components/image_processing/test_init.py b/tests/components/image_processing/test_init.py index cf92047b49a..6415e4e2a4e 100644 --- a/tests/components/image_processing/test_init.py +++ b/tests/components/image_processing/test_init.py @@ -1,4 +1,5 @@ """The tests for the image_processing component.""" + from unittest.mock import PropertyMock, patch import pytest diff --git a/tests/components/light/common.py b/tests/components/light/common.py index 519084d9c34..62b1e199d5d 100644 --- a/tests/components/light/common.py +++ b/tests/components/light/common.py @@ -3,6 +3,7 @@ All containing methods are legacy helpers that should not be used by new components. Instead call the service directly. """ + from collections.abc import Callable from homeassistant.components.light import ( diff --git a/tests/components/light/test_init.py b/tests/components/light/test_init.py index b66ae5819c5..2ebf8af52bb 100644 --- a/tests/components/light/test_init.py +++ b/tests/components/light/test_init.py @@ -1,4 +1,5 @@ """The tests for the Light component.""" + from unittest.mock import MagicMock, mock_open, patch import pytest diff --git a/tests/components/melissa/__init__.py b/tests/components/melissa/__init__.py index 24b278b3c3a..870727eea8f 100644 --- a/tests/components/melissa/__init__.py +++ b/tests/components/melissa/__init__.py @@ -1,4 +1,5 @@ """Tests for the melissa component.""" + from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component diff --git a/tests/components/melissa/test_init.py b/tests/components/melissa/test_init.py index 6ad86ba4595..d809f42e409 100644 --- a/tests/components/melissa/test_init.py +++ b/tests/components/melissa/test_init.py @@ -1,6 +1,5 @@ """The test for the Melissa Climate component.""" - from homeassistant.core import HomeAssistant from tests.components.melissa import setup_integration diff --git a/tests/components/ring/test_camera.py b/tests/components/ring/test_camera.py index 5fd05dd8f28..de61d7a1452 100644 --- a/tests/components/ring/test_camera.py +++ b/tests/components/ring/test_camera.py @@ -1,4 +1,5 @@ """The tests for the Ring switch platform.""" + from unittest.mock import PropertyMock, patch import pytest diff --git a/tests/components/ring/test_light.py b/tests/components/ring/test_light.py index 9680c21abfc..621c0b8f1d0 100644 --- a/tests/components/ring/test_light.py +++ b/tests/components/ring/test_light.py @@ -1,4 +1,5 @@ """The tests for the Ring light platform.""" + from unittest.mock import PropertyMock, patch import pytest diff --git a/tests/components/ring/test_siren.py b/tests/components/ring/test_siren.py index 132c75996a9..b3d46c601de 100644 --- a/tests/components/ring/test_siren.py +++ b/tests/components/ring/test_siren.py @@ -1,4 +1,5 @@ """The tests for the Ring button platform.""" + from unittest.mock import patch import pytest diff --git a/tests/components/ring/test_switch.py b/tests/components/ring/test_switch.py index e8e860cc162..e4ddd7cd855 100644 --- a/tests/components/ring/test_switch.py +++ b/tests/components/ring/test_switch.py @@ -1,4 +1,5 @@ """The tests for the Ring switch platform.""" + from unittest.mock import PropertyMock, patch import pytest diff --git a/tests/components/rova/test_config_flow.py b/tests/components/rova/test_config_flow.py index b5d590f7891..b78e798c120 100644 --- a/tests/components/rova/test_config_flow.py +++ b/tests/components/rova/test_config_flow.py @@ -1,4 +1,5 @@ """Tests for the Rova config flow.""" + from unittest.mock import MagicMock import pytest diff --git a/tests/components/teslemetry/test_sensor.py b/tests/components/teslemetry/test_sensor.py index 59b3cf08bce..be541da6728 100644 --- a/tests/components/teslemetry/test_sensor.py +++ b/tests/components/teslemetry/test_sensor.py @@ -1,4 +1,5 @@ """Test the Teslemetry sensor platform.""" + from datetime import timedelta from freezegun.api import FrozenDateTimeFactory diff --git a/tests/components/tplink_omada/test_switch.py b/tests/components/tplink_omada/test_switch.py index aa5cd5d33c4..bcc727da06e 100644 --- a/tests/components/tplink_omada/test_switch.py +++ b/tests/components/tplink_omada/test_switch.py @@ -1,4 +1,5 @@ """Tests for TP-Link Omada switch entities.""" + from datetime import timedelta from typing import Any from unittest.mock import MagicMock diff --git a/tests/components/webmin/test_diagnostics.py b/tests/components/webmin/test_diagnostics.py index 33a349878d1..5f1df44f4a8 100644 --- a/tests/components/webmin/test_diagnostics.py +++ b/tests/components/webmin/test_diagnostics.py @@ -1,4 +1,5 @@ """Tests for the diagnostics data provided by the Webmin integration.""" + from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant diff --git a/tests/components/whirlpool/__init__.py b/tests/components/whirlpool/__init__.py index ac52031a0fc..ca00975941a 100644 --- a/tests/components/whirlpool/__init__.py +++ b/tests/components/whirlpool/__init__.py @@ -1,4 +1,5 @@ """Tests for the Whirlpool Sixth Sense integration.""" + from homeassistant.components.whirlpool.const import CONF_BRAND, DOMAIN from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME from homeassistant.core import HomeAssistant diff --git a/tests/helpers/test_category_registry.py b/tests/helpers/test_category_registry.py index d204ec21e39..a6a36940a68 100644 --- a/tests/helpers/test_category_registry.py +++ b/tests/helpers/test_category_registry.py @@ -1,4 +1,5 @@ """Tests for the category registry.""" + import re from typing import Any diff --git a/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py b/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py index c4d88fd17d7..b9080a2048a 100644 --- a/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py +++ b/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py @@ -1,4 +1,5 @@ """Provide a mock package component.""" + from .const import TEST # noqa: F401 diff --git a/tests/testing_config/custom_components/test_package_loaded_loop/const.py b/tests/testing_config/custom_components/test_package_loaded_loop/const.py index 7e13e04cb47..e55504e7f4f 100644 --- a/tests/testing_config/custom_components/test_package_loaded_loop/const.py +++ b/tests/testing_config/custom_components/test_package_loaded_loop/const.py @@ -1,2 +1,3 @@ """Constants for test_package custom component.""" + TEST = 5