diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index 7dba27b..df370e1 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -2,8 +2,9 @@ from __future__ import annotations import asyncio import logging +from collections.abc import Awaitable, Coroutine from functools import partial -from typing import TYPE_CHECKING, Any, Awaitable, Callable, Coroutine, Union, cast +from typing import TYPE_CHECKING, Any, Callable, Union, cast from google.protobuf import message diff --git a/aioesphomeapi/log_runner.py b/aioesphomeapi/log_runner.py index cf35d9d..28556d6 100644 --- a/aioesphomeapi/log_runner.py +++ b/aioesphomeapi/log_runner.py @@ -1,7 +1,8 @@ from __future__ import annotations import logging -from typing import Any, Callable, Coroutine +from collections.abc import Coroutine +from typing import Any, Callable from zeroconf.asyncio import AsyncZeroconf diff --git a/aioesphomeapi/model.py b/aioesphomeapi/model.py index 6c1538e..0bbf219 100644 --- a/aioesphomeapi/model.py +++ b/aioesphomeapi/model.py @@ -2,9 +2,10 @@ from __future__ import annotations import enum import sys +from collections.abc import Iterable from dataclasses import asdict, dataclass, field, fields from functools import cache, lru_cache, partial -from typing import TYPE_CHECKING, Any, Callable, Iterable, Optional, TypeVar, cast +from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast from uuid import UUID from .util import fix_float_single_double_conversion @@ -768,7 +769,7 @@ class TextInfo(EntityInfo): min_length: int = 0 max_length: int = 255 pattern: str = "" - mode: Optional[TextMode] = converter_field( + mode: TextMode | None = converter_field( default=TextMode.TEXT, converter=TextMode.convert ) diff --git a/tests/__init__.py b/tests/__init__.py index 827ca63..2c99c93 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,5 @@ """Init tests.""" +from __future__ import annotations import logging diff --git a/tests/test_client.py b/tests/test_client.py index 2d57540..899fb10 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import asyncio from unittest.mock import AsyncMock, MagicMock, patch diff --git a/tests/test_host_resolver.py b/tests/test_host_resolver.py index f995b96..66eeb93 100644 --- a/tests/test_host_resolver.py +++ b/tests/test_host_resolver.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import socket from ipaddress import ip_address from unittest.mock import AsyncMock, MagicMock, patch diff --git a/tests/test_log_runner.py b/tests/test_log_runner.py index 5ff1686..92442e8 100644 --- a/tests/test_log_runner.py +++ b/tests/test_log_runner.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import asyncio from unittest.mock import MagicMock, patch diff --git a/tests/test_model.py b/tests/test_model.py index 14951a0..cf9df81 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from dataclasses import dataclass, field -from typing import Optional import pytest @@ -129,7 +130,7 @@ def test_api_int_enum_convert_list(input, output): @dataclass(frozen=True) class DummyAPIModel(APIModelBase): val1: int = 0 - val2: Optional[DummyIntEnum] = converter_field( + val2: DummyIntEnum | None = converter_field( default=DummyIntEnum.DEFAULT, converter=DummyIntEnum.convert ) diff --git a/tests/test_reconnect_logic.py b/tests/test_reconnect_logic.py index 0684650..f2ec698 100644 --- a/tests/test_reconnect_logic.py +++ b/tests/test_reconnect_logic.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import asyncio import logging from ipaddress import ip_address