diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 4ea324878ec..4ed80c27bf0 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -1,4 +1,5 @@ """Start Home Assistant.""" + from __future__ import annotations import argparse diff --git a/homeassistant/auth/__init__.py b/homeassistant/auth/__init__.py index fa89134305e..969fcc3529e 100644 --- a/homeassistant/auth/__init__.py +++ b/homeassistant/auth/__init__.py @@ -1,4 +1,5 @@ """Provide an authentication layer for Home Assistant.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/auth/auth_store.py b/homeassistant/auth/auth_store.py index 983ba7da6a1..b9f7b3a7e14 100644 --- a/homeassistant/auth/auth_store.py +++ b/homeassistant/auth/auth_store.py @@ -1,4 +1,5 @@ """Storage for auth models.""" + from __future__ import annotations from datetime import timedelta diff --git a/homeassistant/auth/const.py b/homeassistant/auth/const.py index 704f5d1d57c..05b9e6d7ad6 100644 --- a/homeassistant/auth/const.py +++ b/homeassistant/auth/const.py @@ -1,4 +1,5 @@ """Constants for the auth module.""" + from datetime import timedelta ACCESS_TOKEN_EXPIRATION = timedelta(minutes=30) diff --git a/homeassistant/auth/jwt_wrapper.py b/homeassistant/auth/jwt_wrapper.py index c681df66557..58f9260ff8f 100644 --- a/homeassistant/auth/jwt_wrapper.py +++ b/homeassistant/auth/jwt_wrapper.py @@ -4,6 +4,7 @@ Since we decode the same tokens over and over again we can cache the result of the decode of valid tokens to speed up the process. """ + from __future__ import annotations from datetime import timedelta diff --git a/homeassistant/auth/mfa_modules/__init__.py b/homeassistant/auth/mfa_modules/__init__.py index aa28710d8c6..0cfb7508dbf 100644 --- a/homeassistant/auth/mfa_modules/__init__.py +++ b/homeassistant/auth/mfa_modules/__init__.py @@ -1,4 +1,5 @@ """Pluggable auth modules for Home Assistant.""" + from __future__ import annotations import importlib diff --git a/homeassistant/auth/mfa_modules/insecure_example.py b/homeassistant/auth/mfa_modules/insecure_example.py index a50b762b121..fc696fe1b63 100644 --- a/homeassistant/auth/mfa_modules/insecure_example.py +++ b/homeassistant/auth/mfa_modules/insecure_example.py @@ -1,4 +1,5 @@ """Example auth module.""" + from __future__ import annotations from typing import Any diff --git a/homeassistant/auth/mfa_modules/notify.py b/homeassistant/auth/mfa_modules/notify.py index 4c5b3a2380b..72edb195a81 100644 --- a/homeassistant/auth/mfa_modules/notify.py +++ b/homeassistant/auth/mfa_modules/notify.py @@ -2,6 +2,7 @@ Sending HOTP through notify service """ + from __future__ import annotations import asyncio diff --git a/homeassistant/auth/mfa_modules/totp.py b/homeassistant/auth/mfa_modules/totp.py index 0c02ef4bd8d..e9055b45f05 100644 --- a/homeassistant/auth/mfa_modules/totp.py +++ b/homeassistant/auth/mfa_modules/totp.py @@ -1,4 +1,5 @@ """Time-based One Time Password auth module.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/auth/models.py b/homeassistant/auth/models.py index d71cd682086..2e5f5940544 100644 --- a/homeassistant/auth/models.py +++ b/homeassistant/auth/models.py @@ -1,4 +1,5 @@ """Auth models.""" + from __future__ import annotations from datetime import datetime, timedelta diff --git a/homeassistant/auth/permissions/__init__.py b/homeassistant/auth/permissions/__init__.py index 935f9bfbf65..c0574e9f0ea 100644 --- a/homeassistant/auth/permissions/__init__.py +++ b/homeassistant/auth/permissions/__init__.py @@ -1,4 +1,5 @@ """Permissions for Home Assistant.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/auth/permissions/entities.py b/homeassistant/auth/permissions/entities.py index 4dc221a9ff4..dbe2fea0021 100644 --- a/homeassistant/auth/permissions/entities.py +++ b/homeassistant/auth/permissions/entities.py @@ -1,4 +1,5 @@ """Entity permissions.""" + from __future__ import annotations from collections import OrderedDict diff --git a/homeassistant/auth/permissions/events.py b/homeassistant/auth/permissions/events.py index aec23331664..3146cd99787 100644 --- a/homeassistant/auth/permissions/events.py +++ b/homeassistant/auth/permissions/events.py @@ -1,4 +1,5 @@ """Permission for events.""" + from __future__ import annotations from typing import Final diff --git a/homeassistant/auth/permissions/merge.py b/homeassistant/auth/permissions/merge.py index 121d87f7848..841959b7f31 100644 --- a/homeassistant/auth/permissions/merge.py +++ b/homeassistant/auth/permissions/merge.py @@ -1,4 +1,5 @@ """Merging of policies.""" + from __future__ import annotations from typing import cast diff --git a/homeassistant/auth/permissions/models.py b/homeassistant/auth/permissions/models.py index 9b9c384c74d..086fdd7bd76 100644 --- a/homeassistant/auth/permissions/models.py +++ b/homeassistant/auth/permissions/models.py @@ -1,4 +1,5 @@ """Models for permissions.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/homeassistant/auth/permissions/system_policies.py b/homeassistant/auth/permissions/system_policies.py index b45984653fb..0d445802e7e 100644 --- a/homeassistant/auth/permissions/system_policies.py +++ b/homeassistant/auth/permissions/system_policies.py @@ -1,4 +1,5 @@ """System policies.""" + from .const import CAT_ENTITIES, POLICY_READ, SUBCAT_ALL ADMIN_POLICY = {CAT_ENTITIES: True} diff --git a/homeassistant/auth/permissions/types.py b/homeassistant/auth/permissions/types.py index cf3632d06d5..3411ae860fb 100644 --- a/homeassistant/auth/permissions/types.py +++ b/homeassistant/auth/permissions/types.py @@ -1,4 +1,5 @@ """Common code for permissions.""" + from collections.abc import Mapping # MyPy doesn't support recursion yet. So writing it out as far as we need. diff --git a/homeassistant/auth/permissions/util.py b/homeassistant/auth/permissions/util.py index 402d43b7ab7..db85e18f60c 100644 --- a/homeassistant/auth/permissions/util.py +++ b/homeassistant/auth/permissions/util.py @@ -1,4 +1,5 @@ """Helpers to deal with permissions.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/auth/providers/__init__.py b/homeassistant/auth/providers/__init__.py index 2036178b225..0a3d697eeea 100644 --- a/homeassistant/auth/providers/__init__.py +++ b/homeassistant/auth/providers/__init__.py @@ -1,4 +1,5 @@ """Auth providers for Home Assistant.""" + from __future__ import annotations from collections.abc import Mapping diff --git a/homeassistant/auth/providers/command_line.py b/homeassistant/auth/providers/command_line.py index 346d2cc503f..43cde284a25 100644 --- a/homeassistant/auth/providers/command_line.py +++ b/homeassistant/auth/providers/command_line.py @@ -1,4 +1,5 @@ """Auth provider that validates credentials via an external command.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/auth/providers/homeassistant.py b/homeassistant/auth/providers/homeassistant.py index 2c4fb034dc9..d277ce96fe2 100644 --- a/homeassistant/auth/providers/homeassistant.py +++ b/homeassistant/auth/providers/homeassistant.py @@ -1,4 +1,5 @@ """Home Assistant auth provider.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/auth/providers/insecure_example.py b/homeassistant/auth/providers/insecure_example.py index 851bed6638c..8bcf7569f5a 100644 --- a/homeassistant/auth/providers/insecure_example.py +++ b/homeassistant/auth/providers/insecure_example.py @@ -1,4 +1,5 @@ """Example auth provider.""" + from __future__ import annotations from collections.abc import Mapping diff --git a/homeassistant/auth/providers/legacy_api_password.py b/homeassistant/auth/providers/legacy_api_password.py index 4fcfd4f7b12..f04490a354e 100644 --- a/homeassistant/auth/providers/legacy_api_password.py +++ b/homeassistant/auth/providers/legacy_api_password.py @@ -2,6 +2,7 @@ It will be removed when auth system production ready """ + from __future__ import annotations from collections.abc import Mapping diff --git a/homeassistant/auth/providers/trusted_networks.py b/homeassistant/auth/providers/trusted_networks.py index 54633744bd9..32d1934e093 100644 --- a/homeassistant/auth/providers/trusted_networks.py +++ b/homeassistant/auth/providers/trusted_networks.py @@ -3,6 +3,7 @@ It shows list of users if access from trusted network. Abort login flow if not access from trusted network. """ + from __future__ import annotations from collections.abc import Mapping diff --git a/homeassistant/backports/enum.py b/homeassistant/backports/enum.py index 871244b4567..3c09d8e7f57 100644 --- a/homeassistant/backports/enum.py +++ b/homeassistant/backports/enum.py @@ -6,6 +6,7 @@ Since we have dropped support for Python 3.10, we can remove this backport. This file is kept for now to avoid breaking custom components that might import it. """ + from __future__ import annotations from enum import StrEnum diff --git a/homeassistant/block_async_io.py b/homeassistant/block_async_io.py index d7c1a7c9eea..bf805b5ef21 100644 --- a/homeassistant/block_async_io.py +++ b/homeassistant/block_async_io.py @@ -1,4 +1,5 @@ """Block blocking calls being done in asyncio.""" + from http.client import HTTPConnection import time diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 3d4e79c1ca2..da51332d93d 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -1,4 +1,5 @@ """Provide methods to bootstrap a Home Assistant instance.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/components/__init__.py b/homeassistant/components/__init__.py index 839a66af25d..6a3d12fec5e 100644 --- a/homeassistant/components/__init__.py +++ b/homeassistant/components/__init__.py @@ -6,6 +6,7 @@ Component design guidelines: format ".". - Each component should publish services only under its own domain. """ + from __future__ import annotations import logging diff --git a/homeassistant/config.py b/homeassistant/config.py index 354eb0d858f..92ed7556445 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -1,4 +1,5 @@ """Module to help with parsing and generating configuration files.""" + from __future__ import annotations from collections import OrderedDict diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 6976d6d36a8..b2206912fb3 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1,4 +1,5 @@ """Manage config entries in Home Assistant.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/const.py b/homeassistant/const.py index 3a8d1a09e85..6331b5d46ce 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,4 +1,5 @@ """Constants used by Home Assistant components.""" + from __future__ import annotations from enum import StrEnum diff --git a/homeassistant/core.py b/homeassistant/core.py index 4771213e0d3..a44f8d894ca 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -3,6 +3,7 @@ Home Assistant is a Home Automation framework for observing the state of entities and react to changes. """ + from __future__ import annotations import asyncio diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 4334ec2b274..ac93851bbda 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -1,4 +1,5 @@ """Classes to help gather user submissions.""" + from __future__ import annotations import abc diff --git a/homeassistant/exceptions.py b/homeassistant/exceptions.py index 8d5e2bbde95..a5999510f9f 100644 --- a/homeassistant/exceptions.py +++ b/homeassistant/exceptions.py @@ -1,4 +1,5 @@ """The exceptions used by Home Assistant.""" + from __future__ import annotations from collections.abc import Generator, Sequence diff --git a/homeassistant/helpers/__init__.py b/homeassistant/helpers/__init__.py index 52197e83495..9f72445822e 100644 --- a/homeassistant/helpers/__init__.py +++ b/homeassistant/helpers/__init__.py @@ -1,4 +1,5 @@ """Helper methods for components within Home Assistant.""" + from __future__ import annotations from collections.abc import Iterable, Sequence diff --git a/homeassistant/helpers/aiohttp_client.py b/homeassistant/helpers/aiohttp_client.py index cc0be0d5515..70546e54bcc 100644 --- a/homeassistant/helpers/aiohttp_client.py +++ b/homeassistant/helpers/aiohttp_client.py @@ -1,4 +1,5 @@ """Helper for aiohttp webclient stuff.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/area_registry.py b/homeassistant/helpers/area_registry.py index 7565c87b6b2..f9f4abc6468 100644 --- a/homeassistant/helpers/area_registry.py +++ b/homeassistant/helpers/area_registry.py @@ -1,4 +1,5 @@ """Provide a way to connect devices to one physical location.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/helpers/check_config.py b/homeassistant/helpers/check_config.py index 0de11303cf9..2f716ac8bb1 100644 --- a/homeassistant/helpers/check_config.py +++ b/homeassistant/helpers/check_config.py @@ -1,4 +1,5 @@ """Helper to check the configuration file.""" + from __future__ import annotations from collections import OrderedDict diff --git a/homeassistant/helpers/collection.py b/homeassistant/helpers/collection.py index c3c2ae4ec37..451f96379ac 100644 --- a/homeassistant/helpers/collection.py +++ b/homeassistant/helpers/collection.py @@ -1,4 +1,5 @@ """Helper to deal with YAML + storage.""" + from __future__ import annotations from abc import ABC, abstractmethod diff --git a/homeassistant/helpers/condition.py b/homeassistant/helpers/condition.py index 18894893b88..ab0da9f4478 100644 --- a/homeassistant/helpers/condition.py +++ b/homeassistant/helpers/condition.py @@ -1,4 +1,5 @@ """Offer reusable conditions.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/config_entry_flow.py b/homeassistant/helpers/config_entry_flow.py index 23638dc3549..c4da43a7061 100644 --- a/homeassistant/helpers/config_entry_flow.py +++ b/homeassistant/helpers/config_entry_flow.py @@ -1,4 +1,5 @@ """Helpers for data entry flows for config entries.""" + from __future__ import annotations from collections.abc import Awaitable, Callable diff --git a/homeassistant/helpers/config_entry_oauth2_flow.py b/homeassistant/helpers/config_entry_oauth2_flow.py index dcc0265ab61..83e76ca4ebe 100644 --- a/homeassistant/helpers/config_entry_oauth2_flow.py +++ b/homeassistant/helpers/config_entry_oauth2_flow.py @@ -5,6 +5,7 @@ This module exists of the following parts: - OAuth2 implementation that works with local provided client ID/secret """ + from __future__ import annotations from abc import ABC, ABCMeta, abstractmethod diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 7bf760c3136..3f93eabc786 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -1,4 +1,5 @@ """Helpers for config validation using voluptuous.""" + from __future__ import annotations from collections.abc import Callable, Hashable diff --git a/homeassistant/helpers/data_entry_flow.py b/homeassistant/helpers/data_entry_flow.py index 524fd4ebf7d..1edeb28d88f 100644 --- a/homeassistant/helpers/data_entry_flow.py +++ b/homeassistant/helpers/data_entry_flow.py @@ -1,4 +1,5 @@ """Helpers for the data entry flow.""" + from __future__ import annotations from http import HTTPStatus diff --git a/homeassistant/helpers/debounce.py b/homeassistant/helpers/debounce.py index 298d20485a0..2fe42e19a67 100644 --- a/homeassistant/helpers/debounce.py +++ b/homeassistant/helpers/debounce.py @@ -1,4 +1,5 @@ """Debounce helper.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/deprecation.py b/homeassistant/helpers/deprecation.py index cf76bc78aa5..3266c69db20 100644 --- a/homeassistant/helpers/deprecation.py +++ b/homeassistant/helpers/deprecation.py @@ -1,4 +1,5 @@ """Deprecation helpers for Home Assistant.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index 253b7eaa65c..85d0e8f9966 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -1,4 +1,5 @@ """Provide a way to connect entities belonging to one device.""" + from __future__ import annotations from collections import UserDict diff --git a/homeassistant/helpers/discovery.py b/homeassistant/helpers/discovery.py index 7045966c529..98419ae6bf2 100644 --- a/homeassistant/helpers/discovery.py +++ b/homeassistant/helpers/discovery.py @@ -5,6 +5,7 @@ There are two different types of discoveries that can be fired/listened for. - listen_platform/discover_platform is for platforms. These are used by components to allow discovery of their platforms. """ + from __future__ import annotations from collections.abc import Callable, Coroutine diff --git a/homeassistant/helpers/discovery_flow.py b/homeassistant/helpers/discovery_flow.py index a24e87325ae..b6633a3f718 100644 --- a/homeassistant/helpers/discovery_flow.py +++ b/homeassistant/helpers/discovery_flow.py @@ -1,4 +1,5 @@ """The discovery flow helper.""" + from __future__ import annotations from collections.abc import Coroutine diff --git a/homeassistant/helpers/dispatcher.py b/homeassistant/helpers/dispatcher.py index 59d680a60ee..cb812ef071b 100644 --- a/homeassistant/helpers/dispatcher.py +++ b/homeassistant/helpers/dispatcher.py @@ -1,4 +1,5 @@ """Helpers for Home Assistant dispatcher & internal component/platform.""" + from __future__ import annotations from collections.abc import Callable, Coroutine diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 9fe4af2c6a6..6ec7cbba9b7 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -1,4 +1,5 @@ """An abstract class for entities.""" + from __future__ import annotations from abc import ABCMeta diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index 40b665ed373..fe2d78c02ed 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -1,4 +1,5 @@ """Helpers for components that manage entities.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index e9258f8d1c7..9175d46355e 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -1,4 +1,5 @@ """Class to manage the entities for a single platform.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index df923c15c37..49dfde913e4 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -7,6 +7,7 @@ The Entity Registry will persist itself 10 seconds after a new entity is registered. Registering a new entity while a timer is in progress resets the timer. """ + from __future__ import annotations from collections import UserDict diff --git a/homeassistant/helpers/entity_values.py b/homeassistant/helpers/entity_values.py index fe4a4249c54..7e7bdc7be41 100644 --- a/homeassistant/helpers/entity_values.py +++ b/homeassistant/helpers/entity_values.py @@ -1,4 +1,5 @@ """A class to hold entity values.""" + from __future__ import annotations from collections import OrderedDict diff --git a/homeassistant/helpers/entityfilter.py b/homeassistant/helpers/entityfilter.py index dd61357f53e..cd1960fde12 100644 --- a/homeassistant/helpers/entityfilter.py +++ b/homeassistant/helpers/entityfilter.py @@ -1,4 +1,5 @@ """Helper class to implement include/exclude of entities and domains.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 0233eea37d6..471a996ccdc 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -1,4 +1,5 @@ """Helpers for listening to events.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/floor_registry.py b/homeassistant/helpers/floor_registry.py index d966f6045b6..a701cd5bf79 100644 --- a/homeassistant/helpers/floor_registry.py +++ b/homeassistant/helpers/floor_registry.py @@ -1,4 +1,5 @@ """Provide a way to assign areas to floors in one's home.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/helpers/frame.py b/homeassistant/helpers/frame.py index 3b9c556966a..ee092717753 100644 --- a/homeassistant/helpers/frame.py +++ b/homeassistant/helpers/frame.py @@ -1,4 +1,5 @@ """Provide frame helper for finding the current frame context.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/group.py b/homeassistant/helpers/group.py index 437df226118..7d4eeb6d133 100644 --- a/homeassistant/helpers/group.py +++ b/homeassistant/helpers/group.py @@ -1,4 +1,5 @@ """Helper for groups.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/helpers/http.py b/homeassistant/helpers/http.py index e0f7d59ae9a..7bcb1bedd20 100644 --- a/homeassistant/helpers/http.py +++ b/homeassistant/helpers/http.py @@ -1,4 +1,5 @@ """Helper to track the current http request.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/httpx_client.py b/homeassistant/helpers/httpx_client.py index ed02f8a710e..306d9899cd5 100644 --- a/homeassistant/helpers/httpx_client.py +++ b/homeassistant/helpers/httpx_client.py @@ -1,4 +1,5 @@ """Helper for httpx.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/icon.py b/homeassistant/helpers/icon.py index f1638732527..973c93674b1 100644 --- a/homeassistant/helpers/icon.py +++ b/homeassistant/helpers/icon.py @@ -1,4 +1,5 @@ """Icon helper methods.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/instance_id.py b/homeassistant/helpers/instance_id.py index 5bb8be5a9fe..8bad8f90b9c 100644 --- a/homeassistant/helpers/instance_id.py +++ b/homeassistant/helpers/instance_id.py @@ -1,4 +1,5 @@ """Helper to create a unique instance ID.""" + from __future__ import annotations import logging diff --git a/homeassistant/helpers/integration_platform.py b/homeassistant/helpers/integration_platform.py index 7debae6072f..54e4e0f9fb9 100644 --- a/homeassistant/helpers/integration_platform.py +++ b/homeassistant/helpers/integration_platform.py @@ -1,4 +1,5 @@ """Helpers to help with integration platforms.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/issue_registry.py b/homeassistant/helpers/issue_registry.py index fc8c547404d..11bde0edf6b 100644 --- a/homeassistant/helpers/issue_registry.py +++ b/homeassistant/helpers/issue_registry.py @@ -1,4 +1,5 @@ """Persistently store issues raised by integrations.""" + from __future__ import annotations import dataclasses diff --git a/homeassistant/helpers/json.py b/homeassistant/helpers/json.py index ba2486a196e..28b3d509a0c 100644 --- a/homeassistant/helpers/json.py +++ b/homeassistant/helpers/json.py @@ -1,4 +1,5 @@ """Helpers to help with encoding Home Assistant objects in JSON.""" + from collections import deque from collections.abc import Callable import datetime diff --git a/homeassistant/helpers/label_registry.py b/homeassistant/helpers/label_registry.py index 34c23c98f2a..666a573fe43 100644 --- a/homeassistant/helpers/label_registry.py +++ b/homeassistant/helpers/label_registry.py @@ -1,4 +1,5 @@ """Provide a way to label and group anything.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/helpers/location.py b/homeassistant/helpers/location.py index 086150115da..a12de4f9029 100644 --- a/homeassistant/helpers/location.py +++ b/homeassistant/helpers/location.py @@ -1,4 +1,5 @@ """Location helpers for Home Assistant.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/helpers/network.py b/homeassistant/helpers/network.py index 46d71ccb390..510639b5506 100644 --- a/homeassistant/helpers/network.py +++ b/homeassistant/helpers/network.py @@ -1,4 +1,5 @@ """Network helpers.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/normalized_name_base_registry.py b/homeassistant/helpers/normalized_name_base_registry.py index 13a4cb10312..16280a73750 100644 --- a/homeassistant/helpers/normalized_name_base_registry.py +++ b/homeassistant/helpers/normalized_name_base_registry.py @@ -1,4 +1,5 @@ """Provide a base class for registries that use a normalized name index.""" + from collections import UserDict from collections.abc import ValuesView from dataclasses import dataclass diff --git a/homeassistant/helpers/ratelimit.py b/homeassistant/helpers/ratelimit.py index 12a4cfac406..430ec906bdb 100644 --- a/homeassistant/helpers/ratelimit.py +++ b/homeassistant/helpers/ratelimit.py @@ -1,4 +1,5 @@ """Ratelimit helper.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/redact.py b/homeassistant/helpers/redact.py index f8df73b9180..1ee9eeaae42 100644 --- a/homeassistant/helpers/redact.py +++ b/homeassistant/helpers/redact.py @@ -1,4 +1,5 @@ """Helpers to redact sensitive data.""" + from __future__ import annotations from collections.abc import Callable, Iterable, Mapping diff --git a/homeassistant/helpers/registry.py b/homeassistant/helpers/registry.py index 7b13941e5d2..83079af6228 100644 --- a/homeassistant/helpers/registry.py +++ b/homeassistant/helpers/registry.py @@ -1,4 +1,5 @@ """Provide a base implementation for registries.""" + from __future__ import annotations from abc import ABC, abstractmethod diff --git a/homeassistant/helpers/reload.py b/homeassistant/helpers/reload.py index 983b4e2da52..dcf6a59a71e 100644 --- a/homeassistant/helpers/reload.py +++ b/homeassistant/helpers/reload.py @@ -1,4 +1,5 @@ """Class to reload platforms.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/restore_state.py b/homeassistant/helpers/restore_state.py index 7df83cd0ab9..d0ef3acd426 100644 --- a/homeassistant/helpers/restore_state.py +++ b/homeassistant/helpers/restore_state.py @@ -1,4 +1,5 @@ """Support for restoring entity states on startup.""" + from __future__ import annotations from abc import ABC, abstractmethod diff --git a/homeassistant/helpers/schema_config_entry_flow.py b/homeassistant/helpers/schema_config_entry_flow.py index d5563c995ff..b5b53c91def 100644 --- a/homeassistant/helpers/schema_config_entry_flow.py +++ b/homeassistant/helpers/schema_config_entry_flow.py @@ -1,4 +1,5 @@ """Helpers for creating schema based data entry flows.""" + from __future__ import annotations from abc import ABC, abstractmethod diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index ee5015ad862..da710bd7e24 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -1,4 +1,5 @@ """Helpers to execute scripts.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/script_variables.py b/homeassistant/helpers/script_variables.py index 6c5edfd0ac3..043101b9b86 100644 --- a/homeassistant/helpers/script_variables.py +++ b/homeassistant/helpers/script_variables.py @@ -1,4 +1,5 @@ """Script variables.""" + from __future__ import annotations from collections.abc import Mapping diff --git a/homeassistant/helpers/selector.py b/homeassistant/helpers/selector.py index 8f2d9bf4938..0a893aa87c2 100644 --- a/homeassistant/helpers/selector.py +++ b/homeassistant/helpers/selector.py @@ -1,4 +1,5 @@ """Selectors for Home Assistant.""" + from __future__ import annotations from collections.abc import Callable, Mapping, Sequence diff --git a/homeassistant/helpers/sensor.py b/homeassistant/helpers/sensor.py index 0785a78850a..3cccfb661ee 100644 --- a/homeassistant/helpers/sensor.py +++ b/homeassistant/helpers/sensor.py @@ -1,4 +1,5 @@ """Common functions related to sensor device management.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 42d725c3ce4..c4238c0d116 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -1,4 +1,5 @@ """Service calling related helpers.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/service_info/mqtt.py b/homeassistant/helpers/service_info/mqtt.py index 906072a2d4b..172a5eeff33 100644 --- a/homeassistant/helpers/service_info/mqtt.py +++ b/homeassistant/helpers/service_info/mqtt.py @@ -1,4 +1,5 @@ """MQTT Discovery data.""" + from dataclasses import dataclass import datetime as dt diff --git a/homeassistant/helpers/significant_change.py b/homeassistant/helpers/significant_change.py index 12b78b75fa2..44b103e5c27 100644 --- a/homeassistant/helpers/significant_change.py +++ b/homeassistant/helpers/significant_change.py @@ -26,6 +26,7 @@ The following cases will never be passed to your function: - if either state is unknown/unavailable - state adding/removing """ + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/singleton.py b/homeassistant/helpers/singleton.py index 5579106bb55..91e7a671b69 100644 --- a/homeassistant/helpers/singleton.py +++ b/homeassistant/helpers/singleton.py @@ -1,4 +1,5 @@ """Helper to help coordinating calls.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/start.py b/homeassistant/helpers/start.py index 30e8466070e..148b416e087 100644 --- a/homeassistant/helpers/start.py +++ b/homeassistant/helpers/start.py @@ -1,4 +1,5 @@ """Helpers to help during startup.""" + from __future__ import annotations from collections.abc import Callable, Coroutine diff --git a/homeassistant/helpers/state.py b/homeassistant/helpers/state.py index 673cdf48bc5..71b1b2658e2 100644 --- a/homeassistant/helpers/state.py +++ b/homeassistant/helpers/state.py @@ -1,4 +1,5 @@ """Helpers that help with state related things.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/storage.py b/homeassistant/helpers/storage.py index 39cfac885cc..2af21b070da 100644 --- a/homeassistant/helpers/storage.py +++ b/homeassistant/helpers/storage.py @@ -1,4 +1,5 @@ """Helper to help store data.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/sun.py b/homeassistant/helpers/sun.py index cf944dfc479..a490a7a8213 100644 --- a/homeassistant/helpers/sun.py +++ b/homeassistant/helpers/sun.py @@ -1,4 +1,5 @@ """Helpers for sun events.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/helpers/system_info.py b/homeassistant/helpers/system_info.py index 31097ec923e..a01c3aad377 100644 --- a/homeassistant/helpers/system_info.py +++ b/homeassistant/helpers/system_info.py @@ -1,4 +1,5 @@ """Helper to gather system info.""" + from __future__ import annotations from functools import cache diff --git a/homeassistant/helpers/temperature.py b/homeassistant/helpers/temperature.py index 15d38063f63..0311486fdd2 100644 --- a/homeassistant/helpers/temperature.py +++ b/homeassistant/helpers/temperature.py @@ -1,4 +1,5 @@ """Temperature helpers for Home Assistant.""" + from __future__ import annotations from numbers import Number diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 287e8b065b9..62652e15be9 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -1,4 +1,5 @@ """Template helper methods for rendering strings with Home Assistant data.""" + from __future__ import annotations from ast import literal_eval diff --git a/homeassistant/helpers/trace.py b/homeassistant/helpers/trace.py index 21154914f17..1f5aa47f4e2 100644 --- a/homeassistant/helpers/trace.py +++ b/homeassistant/helpers/trace.py @@ -1,4 +1,5 @@ """Helpers for script and condition tracing.""" + from __future__ import annotations from collections import deque diff --git a/homeassistant/helpers/translation.py b/homeassistant/helpers/translation.py index b799469e2d3..40e8351a3ac 100644 --- a/homeassistant/helpers/translation.py +++ b/homeassistant/helpers/translation.py @@ -1,4 +1,5 @@ """Translation string lookup helpers.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index d98b24f9afd..cb14102cb04 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -1,4 +1,5 @@ """Triggers.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/helpers/trigger_template_entity.py b/homeassistant/helpers/trigger_template_entity.py index bc7deceefef..7b1c4ab8078 100644 --- a/homeassistant/helpers/trigger_template_entity.py +++ b/homeassistant/helpers/trigger_template_entity.py @@ -1,4 +1,5 @@ """TemplateEntity utility class.""" + from __future__ import annotations import contextlib diff --git a/homeassistant/helpers/typing.py b/homeassistant/helpers/typing.py index 4b94e153aef..0f372689809 100644 --- a/homeassistant/helpers/typing.py +++ b/homeassistant/helpers/typing.py @@ -1,4 +1,5 @@ """Typing Helpers for Home Assistant.""" + from collections.abc import Mapping from enum import Enum from typing import Any, TypeVar diff --git a/homeassistant/helpers/update_coordinator.py b/homeassistant/helpers/update_coordinator.py index c3f2c60c8c3..42d7232a4cb 100644 --- a/homeassistant/helpers/update_coordinator.py +++ b/homeassistant/helpers/update_coordinator.py @@ -1,4 +1,5 @@ """Helpers to help coordinate updates.""" + from __future__ import annotations from abc import abstractmethod diff --git a/homeassistant/loader.py b/homeassistant/loader.py index cba7df278f2..57c91f84818 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -3,6 +3,7 @@ This module has quite some complex parts. I have tried to add as much documentation as possible to keep it understandable. """ + from __future__ import annotations import asyncio diff --git a/homeassistant/requirements.py b/homeassistant/requirements.py index f1add1ff3f8..e78398ebf03 100644 --- a/homeassistant/requirements.py +++ b/homeassistant/requirements.py @@ -1,4 +1,5 @@ """Module to handle installing requirements.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/runner.py b/homeassistant/runner.py index 622e69ecf8c..f036c7d6322 100644 --- a/homeassistant/runner.py +++ b/homeassistant/runner.py @@ -1,4 +1,5 @@ """Run Home Assistant.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/scripts/__init__.py b/homeassistant/scripts/__init__.py index 5b781d4eb37..f0600b70f48 100644 --- a/homeassistant/scripts/__init__.py +++ b/homeassistant/scripts/__init__.py @@ -1,4 +1,5 @@ """Home Assistant command line scripts.""" + from __future__ import annotations import argparse diff --git a/homeassistant/scripts/benchmark/__init__.py b/homeassistant/scripts/benchmark/__init__.py index a04493a8935..c4c47f06418 100644 --- a/homeassistant/scripts/benchmark/__init__.py +++ b/homeassistant/scripts/benchmark/__init__.py @@ -1,4 +1,5 @@ """Script to run benchmarks.""" + from __future__ import annotations import argparse diff --git a/homeassistant/scripts/check_config.py b/homeassistant/scripts/check_config.py index 5a9f62c938e..f688a96b11d 100644 --- a/homeassistant/scripts/check_config.py +++ b/homeassistant/scripts/check_config.py @@ -1,4 +1,5 @@ """Script to check the configuration file.""" + from __future__ import annotations import argparse diff --git a/homeassistant/setup.py b/homeassistant/setup.py index 7da82156c3f..3ec72654a64 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -1,4 +1,5 @@ """All methods needed to bootstrap a Home Assistant instance.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/util/__init__.py b/homeassistant/util/__init__.py index 0a4b156fc8c..1ee33bdd173 100644 --- a/homeassistant/util/__init__.py +++ b/homeassistant/util/__init__.py @@ -1,4 +1,5 @@ """Helper methods for various modules.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/util/aiohttp.py b/homeassistant/util/aiohttp.py index ceb5e502221..94906e29f00 100644 --- a/homeassistant/util/aiohttp.py +++ b/homeassistant/util/aiohttp.py @@ -1,4 +1,5 @@ """Utilities to help with aiohttp.""" + from __future__ import annotations from http import HTTPStatus diff --git a/homeassistant/util/async_.py b/homeassistant/util/async_.py index 4ec5028252e..acf5d8e6639 100644 --- a/homeassistant/util/async_.py +++ b/homeassistant/util/async_.py @@ -1,4 +1,5 @@ """Asyncio utilities.""" + from __future__ import annotations from asyncio import AbstractEventLoop, Future, Semaphore, Task, gather, get_running_loop diff --git a/homeassistant/util/color.py b/homeassistant/util/color.py index 0ab4ac8c6c1..ab5c4037f9b 100644 --- a/homeassistant/util/color.py +++ b/homeassistant/util/color.py @@ -1,4 +1,5 @@ """Color util methods.""" + from __future__ import annotations import colorsys diff --git a/homeassistant/util/decorator.py b/homeassistant/util/decorator.py index c648f6f1cab..5bd817de103 100644 --- a/homeassistant/util/decorator.py +++ b/homeassistant/util/decorator.py @@ -1,4 +1,5 @@ """Decorator utility functions.""" + from __future__ import annotations from collections.abc import Callable, Hashable diff --git a/homeassistant/util/dt.py b/homeassistant/util/dt.py index 47863d32e67..5fa27c826b8 100644 --- a/homeassistant/util/dt.py +++ b/homeassistant/util/dt.py @@ -1,4 +1,5 @@ """Helper methods to handle the time in Home Assistant.""" + from __future__ import annotations import bisect diff --git a/homeassistant/util/enum.py b/homeassistant/util/enum.py index f0de2206f1f..d0ef010f8bb 100644 --- a/homeassistant/util/enum.py +++ b/homeassistant/util/enum.py @@ -1,4 +1,5 @@ """Helpers for working with enums.""" + from collections.abc import Callable import contextlib from enum import Enum diff --git a/homeassistant/util/executor.py b/homeassistant/util/executor.py index 145c2ba4f04..cfd81e26e34 100644 --- a/homeassistant/util/executor.py +++ b/homeassistant/util/executor.py @@ -1,4 +1,5 @@ """Executor util helpers.""" + from __future__ import annotations from concurrent.futures import ThreadPoolExecutor diff --git a/homeassistant/util/file.py b/homeassistant/util/file.py index 1af65fa51d7..6d1c9b6e522 100644 --- a/homeassistant/util/file.py +++ b/homeassistant/util/file.py @@ -1,4 +1,5 @@ """File utility functions.""" + from __future__ import annotations import logging diff --git a/homeassistant/util/frozen_dataclass_compat.py b/homeassistant/util/frozen_dataclass_compat.py index 858084bcabc..2bbcadb4ccf 100644 --- a/homeassistant/util/frozen_dataclass_compat.py +++ b/homeassistant/util/frozen_dataclass_compat.py @@ -3,6 +3,7 @@ This module enabled a non-breaking transition from mutable to frozen dataclasses derived from EntityDescription and sub classes thereof. """ + from __future__ import annotations import dataclasses diff --git a/homeassistant/util/json.py b/homeassistant/util/json.py index 3a337cf0e18..9a30ae8f104 100644 --- a/homeassistant/util/json.py +++ b/homeassistant/util/json.py @@ -1,4 +1,5 @@ """JSON utility functions.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/util/language.py b/homeassistant/util/language.py index 73db81c91ce..38fa22730a6 100644 --- a/homeassistant/util/language.py +++ b/homeassistant/util/language.py @@ -1,4 +1,5 @@ """Helper methods for language selection in Home Assistant.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/homeassistant/util/limited_size_dict.py b/homeassistant/util/limited_size_dict.py index a12618af0ec..6166a6c8239 100644 --- a/homeassistant/util/limited_size_dict.py +++ b/homeassistant/util/limited_size_dict.py @@ -1,4 +1,5 @@ """Helpers for script and automation tracing and debugging.""" + from __future__ import annotations from collections import OrderedDict diff --git a/homeassistant/util/location.py b/homeassistant/util/location.py index d2179ecd112..24c49c5427c 100644 --- a/homeassistant/util/location.py +++ b/homeassistant/util/location.py @@ -2,6 +2,7 @@ detect_location_info and elevation are mocked by default during tests. """ + from __future__ import annotations from functools import lru_cache diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index 0f86cde50fe..ac85691b7c2 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -1,4 +1,5 @@ """Logging utilities.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/util/network.py b/homeassistant/util/network.py index 46eaece25c4..08a2c2a3967 100644 --- a/homeassistant/util/network.py +++ b/homeassistant/util/network.py @@ -1,4 +1,5 @@ """Network utilities.""" + from __future__ import annotations from ipaddress import IPv4Address, IPv6Address, ip_address, ip_network diff --git a/homeassistant/util/package.py b/homeassistant/util/package.py index ce6276ef4d4..44f9be3272f 100644 --- a/homeassistant/util/package.py +++ b/homeassistant/util/package.py @@ -1,4 +1,5 @@ """Helpers to install PyPi packages.""" + from __future__ import annotations import asyncio diff --git a/homeassistant/util/percentage.py b/homeassistant/util/percentage.py index cc4835022d3..5f2a1193d96 100644 --- a/homeassistant/util/percentage.py +++ b/homeassistant/util/percentage.py @@ -1,4 +1,5 @@ """Percentage util functions.""" + from __future__ import annotations from typing import TypeVar diff --git a/homeassistant/util/pil.py b/homeassistant/util/pil.py index 58dd48dec5e..733f640ce48 100644 --- a/homeassistant/util/pil.py +++ b/homeassistant/util/pil.py @@ -2,6 +2,7 @@ Can only be used by integrations that have pillow in their requirements. """ + from __future__ import annotations from PIL.ImageDraw import ImageDraw diff --git a/homeassistant/util/read_only_dict.py b/homeassistant/util/read_only_dict.py index bb93dd41298..90245ce7ca9 100644 --- a/homeassistant/util/read_only_dict.py +++ b/homeassistant/util/read_only_dict.py @@ -1,4 +1,5 @@ """Read only dictionary.""" + from typing import Any, TypeVar diff --git a/homeassistant/util/scaling.py b/homeassistant/util/scaling.py index 70e2ac2516a..9b2a4f4afcb 100644 --- a/homeassistant/util/scaling.py +++ b/homeassistant/util/scaling.py @@ -1,4 +1,5 @@ """Scaling util functions.""" + from __future__ import annotations diff --git a/homeassistant/util/timeout.py b/homeassistant/util/timeout.py index 33cc0bd18e6..cf73ee6b220 100644 --- a/homeassistant/util/timeout.py +++ b/homeassistant/util/timeout.py @@ -3,6 +3,7 @@ Set of helper classes to handle timeouts of tasks with advanced options like zones and freezing of timeouts. """ + from __future__ import annotations import asyncio diff --git a/homeassistant/util/ulid.py b/homeassistant/util/ulid.py index 818b8015549..65f1b8226c0 100644 --- a/homeassistant/util/ulid.py +++ b/homeassistant/util/ulid.py @@ -1,4 +1,5 @@ """Helpers to generate ulids.""" + from __future__ import annotations from ulid_transform import ( diff --git a/homeassistant/util/unit_conversion.py b/homeassistant/util/unit_conversion.py index 18318f89da4..04ce0715192 100644 --- a/homeassistant/util/unit_conversion.py +++ b/homeassistant/util/unit_conversion.py @@ -1,4 +1,5 @@ """Typing Helpers for Home Assistant.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/util/unit_system.py b/homeassistant/util/unit_system.py index c9da324e8a5..bd31b4286ab 100644 --- a/homeassistant/util/unit_system.py +++ b/homeassistant/util/unit_system.py @@ -1,4 +1,5 @@ """Unit system helper class and methods.""" + from __future__ import annotations from numbers import Number diff --git a/homeassistant/util/variance.py b/homeassistant/util/variance.py index d28bdc9d63e..974a0f88e90 100644 --- a/homeassistant/util/variance.py +++ b/homeassistant/util/variance.py @@ -1,4 +1,5 @@ """Util functions to help filter out similar results.""" + from __future__ import annotations from collections.abc import Callable diff --git a/homeassistant/util/yaml/__init__.py b/homeassistant/util/yaml/__init__.py index fe4f01677cd..cf90b223cb6 100644 --- a/homeassistant/util/yaml/__init__.py +++ b/homeassistant/util/yaml/__init__.py @@ -1,4 +1,5 @@ """YAML utility functions.""" + from .const import SECRET_YAML from .dumper import dump, save_yaml from .input import UndefinedSubstitution, extract_inputs, substitute diff --git a/homeassistant/util/yaml/dumper.py b/homeassistant/util/yaml/dumper.py index ec4700ef17e..61772b6989d 100644 --- a/homeassistant/util/yaml/dumper.py +++ b/homeassistant/util/yaml/dumper.py @@ -1,4 +1,5 @@ """Custom dumper and representers.""" + from collections import OrderedDict from typing import Any diff --git a/homeassistant/util/yaml/input.py b/homeassistant/util/yaml/input.py index ab5948db605..ff9b37f18f1 100644 --- a/homeassistant/util/yaml/input.py +++ b/homeassistant/util/yaml/input.py @@ -1,4 +1,5 @@ """Deal with YAML input.""" + from __future__ import annotations from typing import Any diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index 055284b1e18..2a2883ed544 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -1,4 +1,5 @@ """Custom loader.""" + from __future__ import annotations from collections.abc import Callable, Iterator diff --git a/homeassistant/util/yaml/objects.py b/homeassistant/util/yaml/objects.py index 6aedc85cf60..70c229c1a2f 100644 --- a/homeassistant/util/yaml/objects.py +++ b/homeassistant/util/yaml/objects.py @@ -1,4 +1,5 @@ """Custom yaml object types.""" + from __future__ import annotations from dataclasses import dataclass diff --git a/pylint/plugins/hass_enforce_coordinator_module.py b/pylint/plugins/hass_enforce_coordinator_module.py index 3546632547b..924b69f1b86 100644 --- a/pylint/plugins/hass_enforce_coordinator_module.py +++ b/pylint/plugins/hass_enforce_coordinator_module.py @@ -1,4 +1,5 @@ """Plugin for checking if coordinator is in its own module.""" + from __future__ import annotations from astroid import nodes diff --git a/pylint/plugins/hass_enforce_sorted_platforms.py b/pylint/plugins/hass_enforce_sorted_platforms.py index f597a7a1191..aa6a6c16efa 100644 --- a/pylint/plugins/hass_enforce_sorted_platforms.py +++ b/pylint/plugins/hass_enforce_sorted_platforms.py @@ -1,4 +1,5 @@ """Plugin for checking sorted platforms list.""" + from __future__ import annotations from astroid import nodes diff --git a/pylint/plugins/hass_enforce_super_call.py b/pylint/plugins/hass_enforce_super_call.py index f2efb8bc8a2..b0f523aef72 100644 --- a/pylint/plugins/hass_enforce_super_call.py +++ b/pylint/plugins/hass_enforce_super_call.py @@ -1,4 +1,5 @@ """Plugin for checking super calls.""" + from __future__ import annotations from astroid import nodes diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index c3c74c95c84..21438ab48ff 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1,4 +1,5 @@ """Plugin to enforce type hints on specific functions.""" + from __future__ import annotations from dataclasses import dataclass diff --git a/pylint/plugins/hass_imports.py b/pylint/plugins/hass_imports.py index f28986b90e2..b8ec65e4460 100644 --- a/pylint/plugins/hass_imports.py +++ b/pylint/plugins/hass_imports.py @@ -1,4 +1,5 @@ """Plugin for checking imports.""" + from __future__ import annotations from dataclasses import dataclass diff --git a/pylint/plugins/hass_inheritance.py b/pylint/plugins/hass_inheritance.py index 7ae24ec6e6d..e386986fa23 100644 --- a/pylint/plugins/hass_inheritance.py +++ b/pylint/plugins/hass_inheritance.py @@ -1,4 +1,5 @@ """Plugin to enforce type hints on specific functions.""" + from __future__ import annotations import re diff --git a/pylint/plugins/hass_logger.py b/pylint/plugins/hass_logger.py index e92fad2bdc0..6cbb72d4f78 100644 --- a/pylint/plugins/hass_logger.py +++ b/pylint/plugins/hass_logger.py @@ -1,4 +1,5 @@ """Plugin for logger invocations.""" + from __future__ import annotations from astroid import nodes diff --git a/script/const.py b/script/const.py index de9b559e634..2f0b12784b5 100644 --- a/script/const.py +++ b/script/const.py @@ -1,4 +1,5 @@ """Script constants.""" + from pathlib import Path COMPONENT_DIR = Path("homeassistant/components") diff --git a/script/countries.py b/script/countries.py index 0d776f0805d..d67caa4da65 100644 --- a/script/countries.py +++ b/script/countries.py @@ -3,6 +3,7 @@ ISO does not publish a machine readable list free of charge, so the list is generated with help of the pycountry package. """ + from pathlib import Path import pycountry diff --git a/script/currencies.py b/script/currencies.py index 753b3363626..388df83e088 100644 --- a/script/currencies.py +++ b/script/currencies.py @@ -1,4 +1,5 @@ """Helper script to update currency list from the official source.""" + from pathlib import Path from bs4 import BeautifulSoup diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index e3fb7c390c0..aea5548aa76 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 """Generate updated constraint and requirements files.""" + from __future__ import annotations import difflib diff --git a/script/hassfest/__main__.py b/script/hassfest/__main__.py index 308c006defc..bcb19a14c37 100644 --- a/script/hassfest/__main__.py +++ b/script/hassfest/__main__.py @@ -1,4 +1,5 @@ """Validate manifests.""" + from __future__ import annotations import argparse diff --git a/script/hassfest/application_credentials.py b/script/hassfest/application_credentials.py index 1be644054c4..40cd15b4676 100644 --- a/script/hassfest/application_credentials.py +++ b/script/hassfest/application_credentials.py @@ -1,4 +1,5 @@ """Generate application_credentials data.""" + from __future__ import annotations from .model import Config, Integration diff --git a/script/hassfest/bluetooth.py b/script/hassfest/bluetooth.py index 295bcac1d1e..9f11c36360e 100644 --- a/script/hassfest/bluetooth.py +++ b/script/hassfest/bluetooth.py @@ -1,4 +1,5 @@ """Generate bluetooth file.""" + from __future__ import annotations from .model import Config, Integration diff --git a/script/hassfest/brand.py b/script/hassfest/brand.py index 80f7416a018..fe47d31067a 100644 --- a/script/hassfest/brand.py +++ b/script/hassfest/brand.py @@ -1,4 +1,5 @@ """Brand validation.""" + from __future__ import annotations import voluptuous as vol diff --git a/script/hassfest/codeowners.py b/script/hassfest/codeowners.py index 458391b1fb4..15e34c23416 100644 --- a/script/hassfest/codeowners.py +++ b/script/hassfest/codeowners.py @@ -1,4 +1,5 @@ """Generate CODEOWNERS.""" + from __future__ import annotations from .model import Config, Integration diff --git a/script/hassfest/config_flow.py b/script/hassfest/config_flow.py index 3f5479fd118..382e77bde74 100644 --- a/script/hassfest/config_flow.py +++ b/script/hassfest/config_flow.py @@ -1,4 +1,5 @@ """Generate config flow file.""" + from __future__ import annotations import json diff --git a/script/hassfest/config_schema.py b/script/hassfest/config_schema.py index da2de9a6013..9f652691887 100644 --- a/script/hassfest/config_schema.py +++ b/script/hassfest/config_schema.py @@ -1,4 +1,5 @@ """Validate integrations which can be setup from YAML have config schemas.""" + from __future__ import annotations import ast diff --git a/script/hassfest/coverage.py b/script/hassfest/coverage.py index b2ee99e896b..64951fb0288 100644 --- a/script/hassfest/coverage.py +++ b/script/hassfest/coverage.py @@ -1,4 +1,5 @@ """Validate coverage files.""" + from __future__ import annotations from pathlib import Path diff --git a/script/hassfest/dependencies.py b/script/hassfest/dependencies.py index 31fd31dfc96..d9ec114e5bb 100644 --- a/script/hassfest/dependencies.py +++ b/script/hassfest/dependencies.py @@ -1,4 +1,5 @@ """Validate dependencies.""" + from __future__ import annotations import ast diff --git a/script/hassfest/dhcp.py b/script/hassfest/dhcp.py index 882e39f300e..bc4c78544c4 100644 --- a/script/hassfest/dhcp.py +++ b/script/hassfest/dhcp.py @@ -1,4 +1,5 @@ """Generate dhcp file.""" + from __future__ import annotations from .model import Config, Integration diff --git a/script/hassfest/docker.py b/script/hassfest/docker.py index 2856c1ee0ea..49b457f8a74 100644 --- a/script/hassfest/docker.py +++ b/script/hassfest/docker.py @@ -1,4 +1,5 @@ """Generate and validate the dockerfile.""" + from homeassistant import core from homeassistant.util import executor, thread diff --git a/script/hassfest/icons.py b/script/hassfest/icons.py index 60dc2b79f56..17f7d6075ce 100644 --- a/script/hassfest/icons.py +++ b/script/hassfest/icons.py @@ -1,4 +1,5 @@ """Validate integration icon translation files.""" + from __future__ import annotations from typing import Any diff --git a/script/hassfest/json.py b/script/hassfest/json.py index 5e3d05f78dc..5e4568cd241 100644 --- a/script/hassfest/json.py +++ b/script/hassfest/json.py @@ -1,4 +1,5 @@ """Validate integration JSON files.""" + from __future__ import annotations import json diff --git a/script/hassfest/manifest.py b/script/hassfest/manifest.py index 6339d8293ec..d8637ad8962 100644 --- a/script/hassfest/manifest.py +++ b/script/hassfest/manifest.py @@ -1,4 +1,5 @@ """Manifest validation.""" + from __future__ import annotations from enum import IntEnum diff --git a/script/hassfest/model.py b/script/hassfest/model.py index 7df65b8221e..736fb6874be 100644 --- a/script/hassfest/model.py +++ b/script/hassfest/model.py @@ -1,4 +1,5 @@ """Models for manifest validator.""" + from __future__ import annotations from dataclasses import dataclass, field diff --git a/script/hassfest/mqtt.py b/script/hassfest/mqtt.py index 2619e22911a..b2112d9bb6a 100644 --- a/script/hassfest/mqtt.py +++ b/script/hassfest/mqtt.py @@ -1,4 +1,5 @@ """Generate MQTT file.""" + from __future__ import annotations from collections import defaultdict diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 5513105fa17..c02ebd8de2e 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -1,4 +1,5 @@ """Generate mypy config.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/script/hassfest/requirements.py b/script/hassfest/requirements.py index 8b9f73336fe..18d560f840f 100644 --- a/script/hassfest/requirements.py +++ b/script/hassfest/requirements.py @@ -1,4 +1,5 @@ """Validate requirements.""" + from __future__ import annotations from collections import deque diff --git a/script/hassfest/serializer.py b/script/hassfest/serializer.py index b56306a8d7e..1de4c48a0c4 100644 --- a/script/hassfest/serializer.py +++ b/script/hassfest/serializer.py @@ -1,4 +1,5 @@ """Hassfest utils.""" + from __future__ import annotations from collections.abc import Collection, Iterable, Mapping diff --git a/script/hassfest/services.py b/script/hassfest/services.py index 8f59d33830d..8489a3a9d68 100644 --- a/script/hassfest/services.py +++ b/script/hassfest/services.py @@ -1,4 +1,5 @@ """Validate dependencies.""" + from __future__ import annotations import contextlib diff --git a/script/hassfest/ssdp.py b/script/hassfest/ssdp.py index de548ee2992..0a61284eb46 100644 --- a/script/hassfest/ssdp.py +++ b/script/hassfest/ssdp.py @@ -1,4 +1,5 @@ """Generate ssdp file.""" + from __future__ import annotations from collections import defaultdict diff --git a/script/hassfest/translations.py b/script/hassfest/translations.py index 1501e4983c5..f595776febe 100644 --- a/script/hassfest/translations.py +++ b/script/hassfest/translations.py @@ -1,4 +1,5 @@ """Validate integration translation files.""" + from __future__ import annotations from functools import partial diff --git a/script/hassfest/usb.py b/script/hassfest/usb.py index c5e3148f7b1..0c7998f4fc2 100644 --- a/script/hassfest/usb.py +++ b/script/hassfest/usb.py @@ -1,4 +1,5 @@ """Generate usb file.""" + from __future__ import annotations from .model import Config, Integration diff --git a/script/hassfest/zeroconf.py b/script/hassfest/zeroconf.py index bb6a84e1e2c..63f10fcf294 100644 --- a/script/hassfest/zeroconf.py +++ b/script/hassfest/zeroconf.py @@ -1,4 +1,5 @@ """Generate zeroconf file.""" + from __future__ import annotations from collections import defaultdict diff --git a/script/microsoft_tts.py b/script/microsoft_tts.py index bc0b577c97c..f3761db2f71 100644 --- a/script/microsoft_tts.py +++ b/script/microsoft_tts.py @@ -1,4 +1,5 @@ """Helper script to update supported languages for Microsoft text-to-speech (TTS).""" + from pathlib import Path from lxml import html diff --git a/script/scaffold/const.py b/script/scaffold/const.py index cf66bb4e2ae..2f8126b3393 100644 --- a/script/scaffold/const.py +++ b/script/scaffold/const.py @@ -1,4 +1,5 @@ """Constants for scaffolding.""" + from pathlib import Path COMPONENT_DIR = Path("homeassistant/components") diff --git a/script/scaffold/docs.py b/script/scaffold/docs.py index 3ce86b0e138..a969fa699dd 100644 --- a/script/scaffold/docs.py +++ b/script/scaffold/docs.py @@ -1,4 +1,5 @@ """Print links to relevant docs.""" + from .model import Info DATA = { diff --git a/script/scaffold/generate.py b/script/scaffold/generate.py index 197c36e22d1..0bee69b93f8 100644 --- a/script/scaffold/generate.py +++ b/script/scaffold/generate.py @@ -1,4 +1,5 @@ """Generate an integration.""" + from pathlib import Path from .model import Info diff --git a/script/scaffold/model.py b/script/scaffold/model.py index 2b1ee71fc63..3b5a5e50fe4 100644 --- a/script/scaffold/model.py +++ b/script/scaffold/model.py @@ -1,4 +1,5 @@ """Models for scaffolding.""" + from __future__ import annotations import json diff --git a/script/scaffold/templates/backup/integration/backup.py b/script/scaffold/templates/backup/integration/backup.py index 88df5ead221..ab3eb1be440 100644 --- a/script/scaffold/templates/backup/integration/backup.py +++ b/script/scaffold/templates/backup/integration/backup.py @@ -1,4 +1,5 @@ """Backup platform for the NEW_NAME integration.""" + from homeassistant.core import HomeAssistant diff --git a/script/scaffold/templates/backup/tests/test_backup.py b/script/scaffold/templates/backup/tests/test_backup.py index 43d23ac7a90..9f3c2be657c 100644 --- a/script/scaffold/templates/backup/tests/test_backup.py +++ b/script/scaffold/templates/backup/tests/test_backup.py @@ -1,4 +1,5 @@ """Test the NEW_NAME backup platform.""" + from homeassistant.components.NEW_DOMAIN.backup import ( async_post_backup, async_pre_backup, diff --git a/script/scaffold/templates/config_flow/integration/__init__.py b/script/scaffold/templates/config_flow/integration/__init__.py index 4d74c5d41ff..87391f1733e 100644 --- a/script/scaffold/templates/config_flow/integration/__init__.py +++ b/script/scaffold/templates/config_flow/integration/__init__.py @@ -1,4 +1,5 @@ """The NEW_NAME integration.""" + from __future__ import annotations from homeassistant.config_entries import ConfigEntry diff --git a/script/scaffold/templates/config_flow/integration/config_flow.py b/script/scaffold/templates/config_flow/integration/config_flow.py index f68059584f7..797ca5c7066 100644 --- a/script/scaffold/templates/config_flow/integration/config_flow.py +++ b/script/scaffold/templates/config_flow/integration/config_flow.py @@ -1,4 +1,5 @@ """Config flow for NEW_NAME integration.""" + from __future__ import annotations import logging diff --git a/script/scaffold/templates/config_flow/tests/conftest.py b/script/scaffold/templates/config_flow/tests/conftest.py index 05993acc329..84b6bb381bf 100644 --- a/script/scaffold/templates/config_flow/tests/conftest.py +++ b/script/scaffold/templates/config_flow/tests/conftest.py @@ -1,4 +1,5 @@ """Common fixtures for the NEW_NAME tests.""" + from collections.abc import Generator from unittest.mock import AsyncMock, patch diff --git a/script/scaffold/templates/config_flow/tests/test_config_flow.py b/script/scaffold/templates/config_flow/tests/test_config_flow.py index bb9e6380cdc..9a712834bae 100644 --- a/script/scaffold/templates/config_flow/tests/test_config_flow.py +++ b/script/scaffold/templates/config_flow/tests/test_config_flow.py @@ -1,4 +1,5 @@ """Test the NEW_NAME config flow.""" + from unittest.mock import AsyncMock, patch from homeassistant import config_entries diff --git a/script/scaffold/templates/config_flow_discovery/integration/__init__.py b/script/scaffold/templates/config_flow_discovery/integration/__init__.py index efa59ddd82a..4d18fecc2fa 100644 --- a/script/scaffold/templates/config_flow_discovery/integration/__init__.py +++ b/script/scaffold/templates/config_flow_discovery/integration/__init__.py @@ -1,4 +1,5 @@ """The NEW_NAME integration.""" + from __future__ import annotations from homeassistant.config_entries import ConfigEntry diff --git a/script/scaffold/templates/config_flow_helper/integration/__init__.py b/script/scaffold/templates/config_flow_helper/integration/__init__.py index 2ad917394b9..c8817fb76ad 100644 --- a/script/scaffold/templates/config_flow_helper/integration/__init__.py +++ b/script/scaffold/templates/config_flow_helper/integration/__init__.py @@ -1,4 +1,5 @@ """The NEW_NAME integration.""" + from __future__ import annotations from homeassistant.config_entries import ConfigEntry diff --git a/script/scaffold/templates/config_flow_helper/integration/config_flow.py b/script/scaffold/templates/config_flow_helper/integration/config_flow.py index f9b8e81d364..5d89fec2da2 100644 --- a/script/scaffold/templates/config_flow_helper/integration/config_flow.py +++ b/script/scaffold/templates/config_flow_helper/integration/config_flow.py @@ -1,4 +1,5 @@ """Config flow for NEW_NAME integration.""" + from __future__ import annotations from collections.abc import Mapping diff --git a/script/scaffold/templates/config_flow_helper/integration/sensor.py b/script/scaffold/templates/config_flow_helper/integration/sensor.py index fbf92bfdd6b..741b2e85eb2 100644 --- a/script/scaffold/templates/config_flow_helper/integration/sensor.py +++ b/script/scaffold/templates/config_flow_helper/integration/sensor.py @@ -1,4 +1,5 @@ """Sensor platform for NEW_NAME integration.""" + from __future__ import annotations from homeassistant.components.sensor import SensorEntity diff --git a/script/scaffold/templates/config_flow_helper/tests/conftest.py b/script/scaffold/templates/config_flow_helper/tests/conftest.py index 05993acc329..84b6bb381bf 100644 --- a/script/scaffold/templates/config_flow_helper/tests/conftest.py +++ b/script/scaffold/templates/config_flow_helper/tests/conftest.py @@ -1,4 +1,5 @@ """Common fixtures for the NEW_NAME tests.""" + from collections.abc import Generator from unittest.mock import AsyncMock, patch diff --git a/script/scaffold/templates/config_flow_helper/tests/test_config_flow.py b/script/scaffold/templates/config_flow_helper/tests/test_config_flow.py index d21c66797d8..085ae289f65 100644 --- a/script/scaffold/templates/config_flow_helper/tests/test_config_flow.py +++ b/script/scaffold/templates/config_flow_helper/tests/test_config_flow.py @@ -1,4 +1,5 @@ """Test the NEW_NAME config flow.""" + from unittest.mock import AsyncMock import pytest diff --git a/script/scaffold/templates/config_flow_oauth2/integration/__init__.py b/script/scaffold/templates/config_flow_oauth2/integration/__init__.py index 213740005e5..7e7641a535b 100644 --- a/script/scaffold/templates/config_flow_oauth2/integration/__init__.py +++ b/script/scaffold/templates/config_flow_oauth2/integration/__init__.py @@ -1,4 +1,5 @@ """The NEW_NAME integration.""" + from __future__ import annotations from homeassistant.config_entries import ConfigEntry diff --git a/script/scaffold/templates/config_flow_oauth2/integration/api.py b/script/scaffold/templates/config_flow_oauth2/integration/api.py index 9ae65bb4d85..3f4aa3cfb82 100644 --- a/script/scaffold/templates/config_flow_oauth2/integration/api.py +++ b/script/scaffold/templates/config_flow_oauth2/integration/api.py @@ -1,4 +1,5 @@ """API for NEW_NAME bound to Home Assistant OAuth.""" + from asyncio import run_coroutine_threadsafe from aiohttp import ClientSession diff --git a/script/scaffold/templates/device_action/integration/device_action.py b/script/scaffold/templates/device_action/integration/device_action.py index 4732d9bd71c..02be0afa602 100644 --- a/script/scaffold/templates/device_action/integration/device_action.py +++ b/script/scaffold/templates/device_action/integration/device_action.py @@ -1,4 +1,5 @@ """Provides device actions for NEW_NAME.""" + from __future__ import annotations import voluptuous as vol diff --git a/script/scaffold/templates/device_condition/integration/device_condition.py b/script/scaffold/templates/device_condition/integration/device_condition.py index 00acd23698a..ba7752a6d60 100644 --- a/script/scaffold/templates/device_condition/integration/device_condition.py +++ b/script/scaffold/templates/device_condition/integration/device_condition.py @@ -1,4 +1,5 @@ """Provide the device conditions for NEW_NAME.""" + from __future__ import annotations import voluptuous as vol diff --git a/script/scaffold/templates/device_condition/tests/test_device_condition.py b/script/scaffold/templates/device_condition/tests/test_device_condition.py index 1f6e0ffde3c..ad6d527bd65 100644 --- a/script/scaffold/templates/device_condition/tests/test_device_condition.py +++ b/script/scaffold/templates/device_condition/tests/test_device_condition.py @@ -1,4 +1,5 @@ """The tests for NEW_NAME device conditions.""" + from __future__ import annotations import pytest diff --git a/script/scaffold/templates/device_trigger/integration/device_trigger.py b/script/scaffold/templates/device_trigger/integration/device_trigger.py index 4179bf5248a..8dcf438efc0 100644 --- a/script/scaffold/templates/device_trigger/integration/device_trigger.py +++ b/script/scaffold/templates/device_trigger/integration/device_trigger.py @@ -1,4 +1,5 @@ """Provides device triggers for NEW_NAME.""" + from __future__ import annotations from typing import Any diff --git a/script/scaffold/templates/integration/integration/__init__.py b/script/scaffold/templates/integration/integration/__init__.py index e30cd400bf2..66da2698015 100644 --- a/script/scaffold/templates/integration/integration/__init__.py +++ b/script/scaffold/templates/integration/integration/__init__.py @@ -1,4 +1,5 @@ """The NEW_NAME integration.""" + from __future__ import annotations import voluptuous as vol diff --git a/script/scaffold/templates/reproduce_state/integration/reproduce_state.py b/script/scaffold/templates/reproduce_state/integration/reproduce_state.py index 4247a1dc8d2..ae1eb622e5b 100644 --- a/script/scaffold/templates/reproduce_state/integration/reproduce_state.py +++ b/script/scaffold/templates/reproduce_state/integration/reproduce_state.py @@ -1,4 +1,5 @@ """Reproduce an NEW_NAME state.""" + from __future__ import annotations import asyncio diff --git a/script/scaffold/templates/significant_change/integration/significant_change.py b/script/scaffold/templates/significant_change/integration/significant_change.py index 8e6022f171b..803edc035b2 100644 --- a/script/scaffold/templates/significant_change/integration/significant_change.py +++ b/script/scaffold/templates/significant_change/integration/significant_change.py @@ -1,4 +1,5 @@ """Helper to test significant NEW_NAME state changes.""" + from __future__ import annotations from typing import Any diff --git a/script/scaffold/templates/significant_change/tests/test_significant_change.py b/script/scaffold/templates/significant_change/tests/test_significant_change.py index 89194cc52a3..519a80d8de6 100644 --- a/script/scaffold/templates/significant_change/tests/test_significant_change.py +++ b/script/scaffold/templates/significant_change/tests/test_significant_change.py @@ -1,4 +1,5 @@ """Test the NEW_NAME significant change platform.""" + from homeassistant.components.NEW_DOMAIN.significant_change import ( async_check_significant_change, ) diff --git a/script/translations/download.py b/script/translations/download.py index d02b5c869aa..958a4b35a7b 100755 --- a/script/translations/download.py +++ b/script/translations/download.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 """Merge all translation sources into a single JSON file.""" + from __future__ import annotations import json diff --git a/script/translations/lokalise.py b/script/translations/lokalise.py index a23291169f4..5cd0a695471 100644 --- a/script/translations/lokalise.py +++ b/script/translations/lokalise.py @@ -1,4 +1,5 @@ """API for Lokalise.""" + from __future__ import annotations from pprint import pprint diff --git a/tests/auth/mfa_modules/test_insecure_example.py b/tests/auth/mfa_modules/test_insecure_example.py index d22bfaa0719..f7f8a327059 100644 --- a/tests/auth/mfa_modules/test_insecure_example.py +++ b/tests/auth/mfa_modules/test_insecure_example.py @@ -1,4 +1,5 @@ """Test the example module auth module.""" + from homeassistant import auth, data_entry_flow from homeassistant.auth.mfa_modules import auth_mfa_module_from_config from homeassistant.auth.models import Credentials diff --git a/tests/auth/permissions/test_merge.py b/tests/auth/permissions/test_merge.py index f6251e52998..aeba076b170 100644 --- a/tests/auth/permissions/test_merge.py +++ b/tests/auth/permissions/test_merge.py @@ -1,4 +1,5 @@ """Tests for permissions merging.""" + from homeassistant.auth.permissions.merge import merge_policies diff --git a/tests/auth/permissions/test_system_policies.py b/tests/auth/permissions/test_system_policies.py index c6d9202524b..81b53154485 100644 --- a/tests/auth/permissions/test_system_policies.py +++ b/tests/auth/permissions/test_system_policies.py @@ -1,4 +1,5 @@ """Test system policies.""" + from homeassistant.auth.permissions import ( POLICY_SCHEMA, PolicyPermissions, diff --git a/tests/auth/providers/test_insecure_example.py b/tests/auth/providers/test_insecure_example.py index ceb8b02ae65..f0043231c04 100644 --- a/tests/auth/providers/test_insecure_example.py +++ b/tests/auth/providers/test_insecure_example.py @@ -1,4 +1,5 @@ """Tests for the insecure example auth provider.""" + from unittest.mock import AsyncMock import uuid diff --git a/tests/auth/providers/test_trusted_networks.py b/tests/auth/providers/test_trusted_networks.py index 3ccff990b9c..2f84a256f2d 100644 --- a/tests/auth/providers/test_trusted_networks.py +++ b/tests/auth/providers/test_trusted_networks.py @@ -1,4 +1,5 @@ """Test the Trusted Networks auth provider.""" + from ipaddress import ip_address, ip_network from unittest.mock import Mock, patch diff --git a/tests/auth/test_init.py b/tests/auth/test_init.py index b561b17112b..91db3fd51d4 100644 --- a/tests/auth/test_init.py +++ b/tests/auth/test_init.py @@ -1,4 +1,5 @@ """Tests for the Home Assistant auth module.""" + from datetime import timedelta import time from typing import Any diff --git a/tests/auth/test_models.py b/tests/auth/test_models.py index 3f0ad7acc1d..639e43287b2 100644 --- a/tests/auth/test_models.py +++ b/tests/auth/test_models.py @@ -1,4 +1,5 @@ """Tests for the auth models.""" + from homeassistant.auth import models, permissions diff --git a/tests/common.py b/tests/common.py index cc2b4fa2ad6..5b2314ee038 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,4 +1,5 @@ """Test the helper method for writing tests.""" + from __future__ import annotations import asyncio diff --git a/tests/conftest.py b/tests/conftest.py index 5753729213f..798e3980f7b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Set up some common test helper things.""" + from __future__ import annotations import asyncio diff --git a/tests/hassfest/test_dependencies.py b/tests/hassfest/test_dependencies.py index 98ccbe4eae6..92a7fa27dc4 100644 --- a/tests/hassfest/test_dependencies.py +++ b/tests/hassfest/test_dependencies.py @@ -20,6 +20,7 @@ def test_child_import(mock_collector) -> None: mock_collector.visit( ast.parse( """ + from homeassistant.components import child_import """ ) @@ -32,6 +33,7 @@ def test_subimport(mock_collector) -> None: mock_collector.visit( ast.parse( """ + from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME """ ) @@ -44,6 +46,7 @@ def test_child_import_field(mock_collector) -> None: mock_collector.visit( ast.parse( """ + from homeassistant.components.child_import_field import bla """ ) @@ -95,6 +98,7 @@ def test_all_imports(mock_collector) -> None: mock_collector.visit( ast.parse( """ + from homeassistant.components import child_import from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME diff --git a/tests/hassfest/test_requirements.py b/tests/hassfest/test_requirements.py index e6b247047e2..7cb08621e83 100644 --- a/tests/hassfest/test_requirements.py +++ b/tests/hassfest/test_requirements.py @@ -1,4 +1,5 @@ """Tests for hassfest requirements.""" + from pathlib import Path import pytest diff --git a/tests/helpers/test_aiohttp_client.py b/tests/helpers/test_aiohttp_client.py index 1a9c2b0212e..7ec4e996629 100644 --- a/tests/helpers/test_aiohttp_client.py +++ b/tests/helpers/test_aiohttp_client.py @@ -1,4 +1,5 @@ """Test the aiohttp client helper.""" + from unittest.mock import Mock, patch import aiohttp diff --git a/tests/helpers/test_area_registry.py b/tests/helpers/test_area_registry.py index a1c18d41ec9..1ee8a42b6b9 100644 --- a/tests/helpers/test_area_registry.py +++ b/tests/helpers/test_area_registry.py @@ -1,4 +1,5 @@ """Tests for the Area Registry.""" + from typing import Any import pytest diff --git a/tests/helpers/test_collection.py b/tests/helpers/test_collection.py index a385ca8aeb6..6d2764afb16 100644 --- a/tests/helpers/test_collection.py +++ b/tests/helpers/test_collection.py @@ -1,4 +1,5 @@ """Tests for the collection helper.""" + from __future__ import annotations import logging diff --git a/tests/helpers/test_condition.py b/tests/helpers/test_condition.py index bcb6f4fa971..44a360af215 100644 --- a/tests/helpers/test_condition.py +++ b/tests/helpers/test_condition.py @@ -1,4 +1,5 @@ """Test the condition helper.""" + from datetime import datetime, timedelta from typing import Any from unittest.mock import AsyncMock, patch diff --git a/tests/helpers/test_config_entry_flow.py b/tests/helpers/test_config_entry_flow.py index 71c81b096ca..f59b2163591 100644 --- a/tests/helpers/test_config_entry_flow.py +++ b/tests/helpers/test_config_entry_flow.py @@ -1,4 +1,5 @@ """Tests for the Config Entry Flow helper.""" + from collections.abc import Generator from unittest.mock import Mock, PropertyMock, patch diff --git a/tests/helpers/test_config_entry_oauth2_flow.py b/tests/helpers/test_config_entry_oauth2_flow.py index d237c24f6f3..f91cb3d2f35 100644 --- a/tests/helpers/test_config_entry_oauth2_flow.py +++ b/tests/helpers/test_config_entry_oauth2_flow.py @@ -1,4 +1,5 @@ """Tests for the Somfy config flow.""" + from http import HTTPStatus import logging import time diff --git a/tests/helpers/test_config_validation.py b/tests/helpers/test_config_validation.py index 060800be62d..6481b8e134d 100644 --- a/tests/helpers/test_config_validation.py +++ b/tests/helpers/test_config_validation.py @@ -1,4 +1,5 @@ """Test config validators.""" + from collections import OrderedDict from datetime import date, datetime, timedelta import enum diff --git a/tests/helpers/test_deprecation.py b/tests/helpers/test_deprecation.py index f5089ecbaec..4cca4174e9c 100644 --- a/tests/helpers/test_deprecation.py +++ b/tests/helpers/test_deprecation.py @@ -1,4 +1,5 @@ """Test deprecation helpers.""" + from enum import StrEnum import logging import sys diff --git a/tests/helpers/test_device_registry.py b/tests/helpers/test_device_registry.py index cda117cca26..7f7398ec3de 100644 --- a/tests/helpers/test_device_registry.py +++ b/tests/helpers/test_device_registry.py @@ -1,4 +1,5 @@ """Tests for the Device Registry.""" + from collections.abc import Iterable from contextlib import AbstractContextManager, nullcontext import time diff --git a/tests/helpers/test_discovery.py b/tests/helpers/test_discovery.py index d73bfe84607..dc4b2951b2f 100644 --- a/tests/helpers/test_discovery.py +++ b/tests/helpers/test_discovery.py @@ -1,4 +1,5 @@ """Test discovery helpers.""" + from unittest.mock import patch import pytest diff --git a/tests/helpers/test_discovery_flow.py b/tests/helpers/test_discovery_flow.py index 0b3386f8e04..7710eb2c7c7 100644 --- a/tests/helpers/test_discovery_flow.py +++ b/tests/helpers/test_discovery_flow.py @@ -1,4 +1,5 @@ """Test the discovery flow helper.""" + from unittest.mock import AsyncMock, call, patch import pytest diff --git a/tests/helpers/test_dispatcher.py b/tests/helpers/test_dispatcher.py index add80c941a1..3dd708906b9 100644 --- a/tests/helpers/test_dispatcher.py +++ b/tests/helpers/test_dispatcher.py @@ -1,4 +1,5 @@ """Test dispatcher helpers.""" + from functools import partial import pytest diff --git a/tests/helpers/test_entity_registry.py b/tests/helpers/test_entity_registry.py index 271494b60a6..15703af8103 100644 --- a/tests/helpers/test_entity_registry.py +++ b/tests/helpers/test_entity_registry.py @@ -1,4 +1,5 @@ """Tests for the Entity Registry.""" + from datetime import timedelta from typing import Any from unittest.mock import patch diff --git a/tests/helpers/test_entity_values.py b/tests/helpers/test_entity_values.py index f32db73a788..d41a3718f0c 100644 --- a/tests/helpers/test_entity_values.py +++ b/tests/helpers/test_entity_values.py @@ -1,4 +1,5 @@ """Test the entity values helper.""" + from collections import OrderedDict from homeassistant.helpers.entity_values import EntityValues as EV diff --git a/tests/helpers/test_entityfilter.py b/tests/helpers/test_entityfilter.py index 48bc8110ec5..6ea986f6d20 100644 --- a/tests/helpers/test_entityfilter.py +++ b/tests/helpers/test_entityfilter.py @@ -1,4 +1,5 @@ """The tests for the EntityFilter component.""" + from homeassistant.helpers.entityfilter import ( FILTER_SCHEMA, INCLUDE_EXCLUDE_FILTER_SCHEMA, diff --git a/tests/helpers/test_httpx_client.py b/tests/helpers/test_httpx_client.py index 52a6226c307..2d1baf88b16 100644 --- a/tests/helpers/test_httpx_client.py +++ b/tests/helpers/test_httpx_client.py @@ -1,4 +1,5 @@ """Test the httpx client helper.""" + from unittest.mock import Mock, patch import httpx diff --git a/tests/helpers/test_instance_id.py b/tests/helpers/test_instance_id.py index 8fb6bfd8d7e..3f1326bcd2e 100644 --- a/tests/helpers/test_instance_id.py +++ b/tests/helpers/test_instance_id.py @@ -1,4 +1,5 @@ """Tests for instance ID helper.""" + from json import JSONDecodeError from typing import Any from unittest.mock import patch diff --git a/tests/helpers/test_integration_platform.py b/tests/helpers/test_integration_platform.py index 70874a7a58c..c9f25e796bb 100644 --- a/tests/helpers/test_integration_platform.py +++ b/tests/helpers/test_integration_platform.py @@ -1,4 +1,5 @@ """Test integration platform helpers.""" + from collections.abc import Callable from types import ModuleType from unittest.mock import Mock, patch diff --git a/tests/helpers/test_issue_registry.py b/tests/helpers/test_issue_registry.py index 88f97a65421..66fc9662f75 100644 --- a/tests/helpers/test_issue_registry.py +++ b/tests/helpers/test_issue_registry.py @@ -1,4 +1,5 @@ """Test the repairs websocket API.""" + from typing import Any import pytest diff --git a/tests/helpers/test_location.py b/tests/helpers/test_location.py index 435df26b94c..4c14433188c 100644 --- a/tests/helpers/test_location.py +++ b/tests/helpers/test_location.py @@ -1,4 +1,5 @@ """Tests Home Assistant location helpers.""" + from homeassistant.const import ATTR_FRIENDLY_NAME, ATTR_LATITUDE, ATTR_LONGITUDE from homeassistant.core import HomeAssistant, State from homeassistant.helpers import location diff --git a/tests/helpers/test_network.py b/tests/helpers/test_network.py index 37603a99a8b..cbffdc88e19 100644 --- a/tests/helpers/test_network.py +++ b/tests/helpers/test_network.py @@ -1,4 +1,5 @@ """Test network helper.""" + from unittest.mock import Mock, patch import pytest diff --git a/tests/helpers/test_redact.py b/tests/helpers/test_redact.py index 73461012907..bdc06d77b49 100644 --- a/tests/helpers/test_redact.py +++ b/tests/helpers/test_redact.py @@ -1,4 +1,5 @@ """Test the data redation helper.""" + from homeassistant.helpers.redact import REDACTED, async_redact_data, partial_redact diff --git a/tests/helpers/test_registry.py b/tests/helpers/test_registry.py index 2782d3140f7..40e3d0cbb28 100644 --- a/tests/helpers/test_registry.py +++ b/tests/helpers/test_registry.py @@ -1,4 +1,5 @@ """Tests for the registry.""" + from typing import Any from freezegun.api import FrozenDateTimeFactory diff --git a/tests/helpers/test_restore_state.py b/tests/helpers/test_restore_state.py index 2a01439ccbd..4f8c51c5397 100644 --- a/tests/helpers/test_restore_state.py +++ b/tests/helpers/test_restore_state.py @@ -1,4 +1,5 @@ """The tests for the Restore component.""" + from collections.abc import Coroutine from datetime import datetime, timedelta import logging diff --git a/tests/helpers/test_schema_config_entry_flow.py b/tests/helpers/test_schema_config_entry_flow.py index 58f6a261aef..a23b0311b86 100644 --- a/tests/helpers/test_schema_config_entry_flow.py +++ b/tests/helpers/test_schema_config_entry_flow.py @@ -1,4 +1,5 @@ """Tests for the schema based data entry flows.""" + from __future__ import annotations from collections.abc import Mapping diff --git a/tests/helpers/test_selector.py b/tests/helpers/test_selector.py index 00942b396e8..a01ee4ef69e 100644 --- a/tests/helpers/test_selector.py +++ b/tests/helpers/test_selector.py @@ -1,4 +1,5 @@ """Test selectors.""" + from enum import Enum import pytest diff --git a/tests/helpers/test_singleton.py b/tests/helpers/test_singleton.py index 81579202799..2278683f95e 100644 --- a/tests/helpers/test_singleton.py +++ b/tests/helpers/test_singleton.py @@ -1,4 +1,5 @@ """Test singleton helper.""" + from unittest.mock import Mock import pytest diff --git a/tests/helpers/test_storage_remove.py b/tests/helpers/test_storage_remove.py index affa3429af3..c5d0b4be921 100644 --- a/tests/helpers/test_storage_remove.py +++ b/tests/helpers/test_storage_remove.py @@ -1,4 +1,5 @@ """Tests for the storage helper with minimal mocking.""" + from datetime import timedelta import os from unittest.mock import patch diff --git a/tests/helpers/test_template.py b/tests/helpers/test_template.py index 6ca93e79d5f..47230ef2e67 100644 --- a/tests/helpers/test_template.py +++ b/tests/helpers/test_template.py @@ -1,4 +1,5 @@ """Test Home Assistant template helper methods.""" + from __future__ import annotations from collections.abc import Iterable diff --git a/tests/helpers/test_trigger.py b/tests/helpers/test_trigger.py index 75394cf0e7a..0a15cf9a330 100644 --- a/tests/helpers/test_trigger.py +++ b/tests/helpers/test_trigger.py @@ -1,4 +1,5 @@ """The tests for the trigger helper.""" + from unittest.mock import ANY, AsyncMock, MagicMock, call, patch import pytest diff --git a/tests/helpers/test_update_coordinator.py b/tests/helpers/test_update_coordinator.py index 1e8ef93b872..25f72d76e3c 100644 --- a/tests/helpers/test_update_coordinator.py +++ b/tests/helpers/test_update_coordinator.py @@ -1,4 +1,5 @@ """Tests for the update coordinator.""" + from datetime import timedelta import logging from unittest.mock import AsyncMock, Mock, patch diff --git a/tests/patch_time.py b/tests/patch_time.py index 5f5dc467c9d..3489d4a6baf 100644 --- a/tests/patch_time.py +++ b/tests/patch_time.py @@ -1,4 +1,5 @@ """Patch time related functions.""" + from __future__ import annotations import datetime diff --git a/tests/pylint/conftest.py b/tests/pylint/conftest.py index 2aeb5fbd5b7..2b0fdcf7df5 100644 --- a/tests/pylint/conftest.py +++ b/tests/pylint/conftest.py @@ -1,4 +1,5 @@ """Configuration for pylint tests.""" + from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path import sys diff --git a/tests/pylint/test_enforce_coordinator_module.py b/tests/pylint/test_enforce_coordinator_module.py index 746da8c1d7e..90d88246974 100644 --- a/tests/pylint/test_enforce_coordinator_module.py +++ b/tests/pylint/test_enforce_coordinator_module.py @@ -1,4 +1,5 @@ """Tests for pylint hass_enforce_coordinator_module plugin.""" + from __future__ import annotations import astroid diff --git a/tests/pylint/test_enforce_sorted_platforms.py b/tests/pylint/test_enforce_sorted_platforms.py index 71bde88bc13..d1e6d500cc3 100644 --- a/tests/pylint/test_enforce_sorted_platforms.py +++ b/tests/pylint/test_enforce_sorted_platforms.py @@ -1,4 +1,5 @@ """Tests for pylint hass_enforce_sorted_platforms plugin.""" + from __future__ import annotations import astroid diff --git a/tests/pylint/test_enforce_super_call.py b/tests/pylint/test_enforce_super_call.py index 5e2861b1c74..39a70369e0c 100644 --- a/tests/pylint/test_enforce_super_call.py +++ b/tests/pylint/test_enforce_super_call.py @@ -1,4 +1,5 @@ """Tests for pylint hass_enforce_super_call plugin.""" + from __future__ import annotations from types import ModuleType diff --git a/tests/scripts/test_init.py b/tests/scripts/test_init.py index 44090019a29..44edece1812 100644 --- a/tests/scripts/test_init.py +++ b/tests/scripts/test_init.py @@ -1,4 +1,5 @@ """Test script init.""" + from unittest.mock import patch import homeassistant.scripts as scripts diff --git a/tests/syrupy.py b/tests/syrupy.py index 9209654a607..348a618e90e 100644 --- a/tests/syrupy.py +++ b/tests/syrupy.py @@ -1,4 +1,5 @@ """Home Assistant extension for Syrupy.""" + from __future__ import annotations from contextlib import suppress diff --git a/tests/test_config.py b/tests/test_config.py index 73c541bc7e1..7a7f83b5e6b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,5 @@ """Test config utils.""" + from collections import OrderedDict import contextlib import copy diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index 089d0f6b21b..00601173e71 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -1,4 +1,5 @@ """Test the config manager.""" + from __future__ import annotations import asyncio diff --git a/tests/test_core.py b/tests/test_core.py index 9960e8a1671..9c78c670ba3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,4 +1,5 @@ """Test to verify that Home Assistant core works.""" + from __future__ import annotations import array diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 3f4acd15440..3f18b3527b7 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -1,4 +1,5 @@ """Test to verify that Home Assistant exceptions work.""" + from __future__ import annotations import pytest diff --git a/tests/test_main.py b/tests/test_main.py index b676040252a..32371ae4e6f 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,4 +1,5 @@ """Test methods in __main__.""" + from unittest.mock import PropertyMock, patch from homeassistant import __main__ as main diff --git a/tests/test_test_fixtures.py b/tests/test_test_fixtures.py index eb2103d4272..b240da3e31e 100644 --- a/tests/test_test_fixtures.py +++ b/tests/test_test_fixtures.py @@ -1,4 +1,5 @@ """Test test fixture configuration.""" + from http import HTTPStatus import socket diff --git a/tests/testing_config/custom_components/test/alarm_control_panel.py b/tests/testing_config/custom_components/test/alarm_control_panel.py index 7490a7703a4..204281af3d3 100644 --- a/tests/testing_config/custom_components/test/alarm_control_panel.py +++ b/tests/testing_config/custom_components/test/alarm_control_panel.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity from homeassistant.components.alarm_control_panel.const import ( AlarmControlPanelEntityFeature, diff --git a/tests/testing_config/custom_components/test/binary_sensor.py b/tests/testing_config/custom_components/test/binary_sensor.py index 6deaad22b30..e45e614a82c 100644 --- a/tests/testing_config/custom_components/test/binary_sensor.py +++ b/tests/testing_config/custom_components/test/binary_sensor.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/cover.py b/tests/testing_config/custom_components/test/cover.py index dc89b95981b..66ecd1c9dbc 100644 --- a/tests/testing_config/custom_components/test/cover.py +++ b/tests/testing_config/custom_components/test/cover.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from typing import Any from homeassistant.components.cover import CoverEntity, CoverEntityFeature diff --git a/tests/testing_config/custom_components/test/date.py b/tests/testing_config/custom_components/test/date.py index b35be6f1919..0a51bea029d 100644 --- a/tests/testing_config/custom_components/test/date.py +++ b/tests/testing_config/custom_components/test/date.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from datetime import date from homeassistant.components.date import DateEntity diff --git a/tests/testing_config/custom_components/test/datetime.py b/tests/testing_config/custom_components/test/datetime.py index ba511e81648..fa9dfff8a60 100644 --- a/tests/testing_config/custom_components/test/datetime.py +++ b/tests/testing_config/custom_components/test/datetime.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from datetime import UTC, datetime from homeassistant.components.datetime import DateTimeEntity diff --git a/tests/testing_config/custom_components/test/event.py b/tests/testing_config/custom_components/test/event.py index 9acb24f37cf..7dee8390148 100644 --- a/tests/testing_config/custom_components/test/event.py +++ b/tests/testing_config/custom_components/test/event.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.event import EventEntity from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/fan.py b/tests/testing_config/custom_components/test/fan.py index 133f372f4fa..cc38972bc71 100644 --- a/tests/testing_config/custom_components/test/fan.py +++ b/tests/testing_config/custom_components/test/fan.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.fan import FanEntity, FanEntityFeature from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback diff --git a/tests/testing_config/custom_components/test/light.py b/tests/testing_config/custom_components/test/light.py index e22aca289a8..eed98a8210a 100644 --- a/tests/testing_config/custom_components/test/light.py +++ b/tests/testing_config/custom_components/test/light.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.light import ColorMode, LightEntity from homeassistant.const import STATE_OFF, STATE_ON diff --git a/tests/testing_config/custom_components/test/lock.py b/tests/testing_config/custom_components/test/lock.py index 9cefa34363e..ba5a91e2d24 100644 --- a/tests/testing_config/custom_components/test/lock.py +++ b/tests/testing_config/custom_components/test/lock.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.lock import LockEntity, LockEntityFeature from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/number.py b/tests/testing_config/custom_components/test/number.py index 3d9a7f4a8c7..aa4d6fdcd8f 100644 --- a/tests/testing_config/custom_components/test/number.py +++ b/tests/testing_config/custom_components/test/number.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.number import NumberEntity, RestoreNumber from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/remote.py b/tests/testing_config/custom_components/test/remote.py index 6c5242a739e..541215f1c47 100644 --- a/tests/testing_config/custom_components/test/remote.py +++ b/tests/testing_config/custom_components/test/remote.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.remote import RemoteEntity from homeassistant.const import STATE_OFF, STATE_ON diff --git a/tests/testing_config/custom_components/test/select.py b/tests/testing_config/custom_components/test/select.py index d68b3008a50..fece370bdf1 100644 --- a/tests/testing_config/custom_components/test/select.py +++ b/tests/testing_config/custom_components/test/select.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.select import SelectEntity from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/sensor.py b/tests/testing_config/custom_components/test/sensor.py index d436a94e329..b6040227574 100644 --- a/tests/testing_config/custom_components/test/sensor.py +++ b/tests/testing_config/custom_components/test/sensor.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.sensor import ( DEVICE_CLASSES, RestoreSensor, diff --git a/tests/testing_config/custom_components/test/switch.py b/tests/testing_config/custom_components/test/switch.py index 6f132b85a3a..5a2cd7bc17d 100644 --- a/tests/testing_config/custom_components/test/switch.py +++ b/tests/testing_config/custom_components/test/switch.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.const import STATE_OFF, STATE_ON from tests.common import MockToggleEntity diff --git a/tests/testing_config/custom_components/test/text.py b/tests/testing_config/custom_components/test/text.py index b113423b4e3..d3b048747bf 100644 --- a/tests/testing_config/custom_components/test/text.py +++ b/tests/testing_config/custom_components/test/text.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from homeassistant.components.text import RestoreText, TextEntity, TextMode from tests.common import MockEntity diff --git a/tests/testing_config/custom_components/test/time.py b/tests/testing_config/custom_components/test/time.py index 9c2f991d694..998406d7830 100644 --- a/tests/testing_config/custom_components/test/time.py +++ b/tests/testing_config/custom_components/test/time.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from datetime import time from homeassistant.components.time import TimeEntity diff --git a/tests/testing_config/custom_components/test/update.py b/tests/testing_config/custom_components/test/update.py index 36b4e7c692f..40b5742b220 100644 --- a/tests/testing_config/custom_components/test/update.py +++ b/tests/testing_config/custom_components/test/update.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from __future__ import annotations import logging diff --git a/tests/testing_config/custom_components/test/weather.py b/tests/testing_config/custom_components/test/weather.py index 5afb6001b8a..a9ba1c99872 100644 --- a/tests/testing_config/custom_components/test/weather.py +++ b/tests/testing_config/custom_components/test/weather.py @@ -2,6 +2,7 @@ Call init before using it in your tests to ensure clean test data. """ + from __future__ import annotations from typing import Any diff --git a/tests/typing.py b/tests/typing.py index 7c5391d132c..3e6a7cd4bc3 100644 --- a/tests/typing.py +++ b/tests/typing.py @@ -1,4 +1,5 @@ """Typing helpers for Home Assistant tests.""" + from __future__ import annotations from collections.abc import Callable, Coroutine diff --git a/tests/util/test_dt.py b/tests/util/test_dt.py index 3b6293d7c17..5716e4e524c 100644 --- a/tests/util/test_dt.py +++ b/tests/util/test_dt.py @@ -1,4 +1,5 @@ """Test Home Assistant date util methods.""" + from __future__ import annotations from datetime import UTC, datetime, timedelta diff --git a/tests/util/test_enum.py b/tests/util/test_enum.py index e975960bbe0..892c74dedef 100644 --- a/tests/util/test_enum.py +++ b/tests/util/test_enum.py @@ -1,4 +1,5 @@ """Test enum helpers.""" + from enum import Enum, IntEnum, IntFlag, StrEnum from typing import Any diff --git a/tests/util/test_init.py b/tests/util/test_init.py index 6f560376ea4..759f0d6e5ea 100644 --- a/tests/util/test_init.py +++ b/tests/util/test_init.py @@ -1,4 +1,5 @@ """Test Home Assistant util methods.""" + from datetime import datetime, timedelta from unittest.mock import MagicMock, patch diff --git a/tests/util/test_json.py b/tests/util/test_json.py index ba07c7cbb6c..b4a52cb4b41 100644 --- a/tests/util/test_json.py +++ b/tests/util/test_json.py @@ -1,4 +1,5 @@ """Test Home Assistant json utility functions.""" + from pathlib import Path import re diff --git a/tests/util/test_language.py b/tests/util/test_language.py index cc4e5d66c31..a1d0cdf1a53 100644 --- a/tests/util/test_language.py +++ b/tests/util/test_language.py @@ -1,4 +1,5 @@ """Test Home Assistant language util methods.""" + from __future__ import annotations import pytest diff --git a/tests/util/test_location.py b/tests/util/test_location.py index d52362d5ee6..b9252c33e9d 100644 --- a/tests/util/test_location.py +++ b/tests/util/test_location.py @@ -1,4 +1,5 @@ """Test Home Assistant location util methods.""" + from unittest.mock import Mock, patch import aiohttp diff --git a/tests/util/test_unit_conversion.py b/tests/util/test_unit_conversion.py index be8f51af6f9..efac252aa5f 100644 --- a/tests/util/test_unit_conversion.py +++ b/tests/util/test_unit_conversion.py @@ -1,4 +1,5 @@ """Test Home Assistant unit conversion utility functions.""" + from __future__ import annotations import inspect diff --git a/tests/util/test_unit_system.py b/tests/util/test_unit_system.py index 5a199783346..6749627519b 100644 --- a/tests/util/test_unit_system.py +++ b/tests/util/test_unit_system.py @@ -1,4 +1,5 @@ """Test the unit system helper.""" + from __future__ import annotations import pytest diff --git a/tests/util/test_variance.py b/tests/util/test_variance.py index 2072e3f3417..e51f38d5cfd 100644 --- a/tests/util/test_variance.py +++ b/tests/util/test_variance.py @@ -1,4 +1,5 @@ """Test variance method.""" + from datetime import datetime, timedelta import pytest diff --git a/tests/util/yaml/test_init.py b/tests/util/yaml/test_init.py index 9fda5be73a8..185c4cdb22c 100644 --- a/tests/util/yaml/test_init.py +++ b/tests/util/yaml/test_init.py @@ -1,4 +1,5 @@ """Test Home Assistant yaml loader.""" + from collections.abc import Generator import importlib import io