Update some legacy python code to python 3.9 (#635)

This commit is contained in:
J. Nick Koston 2023-11-11 14:19:04 -06:00 committed by GitHub
parent 712efb9c05
commit c1a0500ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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
)

View File

@ -1,4 +1,5 @@
"""Init tests."""
from __future__ import annotations
import logging

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
from unittest.mock import AsyncMock, MagicMock, patch

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import socket
from ipaddress import ip_address
from unittest.mock import AsyncMock, MagicMock, patch

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
from unittest.mock import MagicMock, patch

View File

@ -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
)

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
import logging
from ipaddress import ip_address