mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-09-26 04:12:39 +02:00
Update some legacy python code to python 3.9 (#635)
This commit is contained in:
parent
712efb9c05
commit
c1a0500ecb
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Init tests."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import socket
|
||||
from ipaddress import ip_address
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from ipaddress import ip_address
|
||||
|
Loading…
Reference in New Issue
Block a user