Import names from typing instead of typing_extensions [3.11] (#97065)
This commit is contained in:
parent
7c55dbdb17
commit
77f38e33e5
45 changed files with 45 additions and 94 deletions
|
@ -2,9 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Self
|
||||
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
|
|
|
@ -3,9 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Callable
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Generic, Self, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_R = TypeVar("_R")
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import cast
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Self, cast
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -4,9 +4,7 @@ from __future__ import annotations
|
|||
from dataclasses import asdict, dataclass
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, final
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Self, final
|
||||
|
||||
from homeassistant.backports.enum import StrEnum
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -4,9 +4,7 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from dataclasses import dataclass, field
|
||||
import logging
|
||||
from typing import Any, TypedDict
|
||||
|
||||
from typing_extensions import NotRequired
|
||||
from typing import Any, NotRequired, TypedDict
|
||||
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import cast
|
||||
from typing import Self, cast
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.button import SERVICE_PRESS, ButtonEntity
|
||||
|
|
|
@ -3,9 +3,8 @@ from __future__ import annotations
|
|||
|
||||
import datetime as py_datetime
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from contextlib import suppress
|
||||
import logging
|
||||
from typing import Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any, cast
|
||||
from typing import Any, Self, cast
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.select import (
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -4,9 +4,8 @@ from __future__ import annotations
|
|||
from dataclasses import dataclass
|
||||
from decimal import Decimal, DecimalException, InvalidOperation
|
||||
import logging
|
||||
from typing import Any, Final
|
||||
from typing import Any, Final, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
|
|
|
@ -8,9 +8,8 @@ from datetime import timedelta
|
|||
from enum import IntFlag
|
||||
import logging
|
||||
import os
|
||||
from typing import Any, cast, final
|
||||
from typing import Any, Self, cast, final
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.backports.enum import StrEnum
|
||||
|
|
|
@ -12,14 +12,13 @@ import hashlib
|
|||
from http import HTTPStatus
|
||||
import logging
|
||||
import secrets
|
||||
from typing import Any, Final, TypedDict, final
|
||||
from typing import Any, Final, Required, TypedDict, final
|
||||
from urllib.parse import quote, urlparse
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE
|
||||
from aiohttp.typedefs import LooseHeaders
|
||||
import async_timeout
|
||||
from typing_extensions import Required
|
||||
import voluptuous as vol
|
||||
from yarl import URL
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@ from datetime import timedelta
|
|||
import logging
|
||||
from random import randrange
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
import metno
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -8,10 +8,10 @@ from queue import Queue
|
|||
import re
|
||||
import threading
|
||||
import time
|
||||
from typing import Self
|
||||
from urllib.parse import unquote
|
||||
|
||||
from minio import Minio
|
||||
from typing_extensions import Self
|
||||
from urllib3.exceptions import HTTPError
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -8,9 +8,8 @@ from datetime import timedelta
|
|||
import inspect
|
||||
import logging
|
||||
from math import ceil, floor
|
||||
from typing import Any, final
|
||||
from typing import Any, Self, final
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -5,7 +5,7 @@ from collections.abc import Callable
|
|||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, cast
|
||||
from typing import Any, Self, cast
|
||||
|
||||
import ciso8601
|
||||
from fnv_hash_fast import fnv1a_32
|
||||
|
@ -33,7 +33,6 @@ from sqlalchemy.engine.interfaces import Dialect
|
|||
from sqlalchemy.ext.compiler import compiles
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, aliased, mapped_column, relationship
|
||||
from sqlalchemy.types import TypeDecorator
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.const import (
|
||||
MAX_LENGTH_EVENT_EVENT_TYPE,
|
||||
|
|
|
@ -11,9 +11,7 @@ import logging
|
|||
from math import ceil, floor, log10
|
||||
import re
|
||||
import sys
|
||||
from typing import Any, Final, cast, final
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Final, Self, cast, final
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
||||
|
|
|
@ -8,11 +8,10 @@ import datetime
|
|||
from io import SEEK_END, BytesIO
|
||||
import logging
|
||||
from threading import Event
|
||||
from typing import Any, cast
|
||||
from typing import Any, Self, cast
|
||||
|
||||
import attr
|
||||
import av
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ from dataclasses import dataclass
|
|||
from datetime import datetime, timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
|
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
from collections.abc import Callable
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,10 +5,9 @@ import base64
|
|||
from dataclasses import dataclass
|
||||
import json
|
||||
import struct
|
||||
from typing import Any, Literal, overload
|
||||
from typing import Any, Literal, Self, overload
|
||||
|
||||
from tuya_iot import TuyaDevice, TuyaDeviceManager
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
|
|
@ -5,10 +5,9 @@ from dataclasses import dataclass
|
|||
from datetime import datetime, timedelta
|
||||
from decimal import Decimal, DecimalException, InvalidOperation
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
from croniter import croniter
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
|
|
|
@ -7,9 +7,7 @@ from dataclasses import dataclass
|
|||
from datetime import timedelta
|
||||
import inspect
|
||||
import logging
|
||||
from typing import Any, Final, Literal, TypedDict, final
|
||||
|
||||
from typing_extensions import Required
|
||||
from typing import Any, Final, Literal, Required, TypedDict, final
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -7,12 +7,12 @@ import contextlib
|
|||
from datetime import datetime
|
||||
from ipaddress import IPv4Address
|
||||
import logging
|
||||
from typing import Self
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import async_timeout
|
||||
from async_upnp_client.search import SsdpSearchListener
|
||||
from async_upnp_client.utils import CaseInsensitiveDict
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components import network, ssdp
|
||||
|
|
|
@ -4,9 +4,8 @@ from __future__ import annotations
|
|||
import abc
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import zigpy.exceptions
|
||||
from zigpy.zcl.foundation import Status
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ from enum import Enum
|
|||
import logging
|
||||
import random
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
from zigpy import types
|
||||
import zigpy.device
|
||||
import zigpy.exceptions
|
||||
|
|
|
@ -5,9 +5,7 @@ import asyncio
|
|||
from collections.abc import Callable
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.core import CALLBACK_TYPE, Event, callback
|
||||
|
|
|
@ -3,9 +3,8 @@ from __future__ import annotations
|
|||
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import zigpy.exceptions
|
||||
from zigpy.zcl.foundation import Status
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@ from __future__ import annotations
|
|||
from enum import Enum
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
from zigpy import types
|
||||
from zigpy.zcl.clusters.general import OnOff
|
||||
from zigpy.zcl.clusters.security import IasWd
|
||||
|
|
|
@ -5,9 +5,8 @@ import enum
|
|||
import functools
|
||||
import numbers
|
||||
import sys
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
from zigpy import types
|
||||
|
||||
from homeassistant.components.climate import HVACAction
|
||||
|
|
|
@ -3,9 +3,8 @@ from __future__ import annotations
|
|||
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import zigpy.exceptions
|
||||
from zigpy.zcl.clusters.general import OnOff
|
||||
from zigpy.zcl.foundation import Status
|
||||
|
|
|
@ -4,9 +4,8 @@ from __future__ import annotations
|
|||
from collections.abc import Callable
|
||||
import logging
|
||||
from operator import attrgetter
|
||||
from typing import Any, cast
|
||||
from typing import Any, Self, cast
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
|
|
@ -11,9 +11,7 @@ import functools
|
|||
import logging
|
||||
from random import randint
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import TYPE_CHECKING, Any, Self, TypeVar, cast
|
||||
|
||||
from . import data_entry_flow, loader
|
||||
from .backports.enum import StrEnum
|
||||
|
|
|
@ -31,6 +31,7 @@ from typing import (
|
|||
Any,
|
||||
Generic,
|
||||
ParamSpec,
|
||||
Self,
|
||||
TypeVar,
|
||||
cast,
|
||||
overload,
|
||||
|
@ -38,7 +39,6 @@ from typing import (
|
|||
from urllib.parse import urlparse
|
||||
|
||||
import async_timeout
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
import yarl
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@ import copy
|
|||
from dataclasses import dataclass
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, TypedDict
|
||||
from typing import Any, Required, TypedDict
|
||||
|
||||
from typing_extensions import Required
|
||||
import voluptuous as vol
|
||||
|
||||
from .backports.enum import StrEnum
|
||||
|
|
|
@ -5,9 +5,8 @@ from collections import OrderedDict
|
|||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
from typing import NamedTuple, Self
|
||||
|
||||
from typing_extensions import Self
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import loader
|
||||
|
|
|
@ -3,10 +3,9 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Callable
|
||||
import sys
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
|
||||
import httpx
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.const import APPLICATION_NAME, EVENT_HOMEASSISTANT_CLOSE, __version__
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
|
|
|
@ -4,9 +4,7 @@ from __future__ import annotations
|
|||
from abc import ABC, abstractmethod
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, cast
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Self, cast
|
||||
|
||||
from homeassistant.const import ATTR_RESTORED, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant, State, callback, valid_entity_id
|
||||
|
|
|
@ -4,10 +4,9 @@ from __future__ import annotations
|
|||
from collections.abc import Callable, Mapping, Sequence
|
||||
from enum import IntFlag
|
||||
from functools import cache
|
||||
from typing import Any, Generic, Literal, TypedDict, TypeVar, cast
|
||||
from typing import Any, Generic, Literal, Required, TypedDict, TypeVar, cast
|
||||
from uuid import UUID
|
||||
|
||||
from typing_extensions import Required
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.backports.enum import StrEnum
|
||||
|
|
|
@ -8,9 +8,7 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
import enum
|
||||
from types import TracebackType
|
||||
from typing import Any
|
||||
|
||||
from typing_extensions import Self
|
||||
from typing import Any, Self
|
||||
|
||||
from .async_ import run_callback_threadsafe
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from collections.abc import Callable
|
|||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, TypedDict, cast, overload
|
||||
from typing import Any, Self, TypedDict, cast, overload
|
||||
|
||||
import ciso8601
|
||||
from fnv_hash_fast import fnv1a_32
|
||||
|
@ -34,7 +34,6 @@ from sqlalchemy import (
|
|||
from sqlalchemy.dialects import mysql, oracle, postgresql, sqlite
|
||||
from sqlalchemy.orm import aliased, declarative_base, relationship
|
||||
from sqlalchemy.orm.session import Session
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.components.recorder.const import SupportedDialect
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -9,7 +9,7 @@ from collections.abc import Callable
|
|||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, TypedDict, cast, overload
|
||||
from typing import Any, Self, TypedDict, cast, overload
|
||||
|
||||
import ciso8601
|
||||
from fnv_hash_fast import fnv1a_32
|
||||
|
@ -34,7 +34,6 @@ from sqlalchemy import (
|
|||
from sqlalchemy.dialects import mysql, oracle, postgresql, sqlite
|
||||
from sqlalchemy.orm import aliased, declarative_base, relationship
|
||||
from sqlalchemy.orm.session import Session
|
||||
from typing_extensions import Self
|
||||
|
||||
from homeassistant.components.recorder.const import SupportedDialect
|
||||
from homeassistant.const import (
|
||||
|
|
Loading…
Add table
Reference in a new issue