diff --git a/psycopg/_compat.py b/psycopg/_compat.py index 7dbae79..b3f2a1c 100644 --- a/psycopg/_compat.py +++ b/psycopg/_compat.py @@ -11,12 +11,11 @@ from typing import Any, Awaitable, Generator, Optional, Sequence, Union, TypeVar # NOTE: TypeAlias cannot be exported by this module, as pyright special-cases it. # For this raisin it must be imported directly from typing_extension where used. # See https://github.com/microsoft/pyright/issues/4197 -from typing_extensions import TypeAlias if sys.version_info >= (3, 8): - from typing import Protocol + from typing import Protocol, TypeAlias else: - from typing_extensions import Protocol + from typing import Protocol T = TypeVar("T") FutureT: TypeAlias = Union["asyncio.Future[T]", Generator[Any, None, T], Awaitable[T]] @@ -52,12 +51,12 @@ else: if sys.version_info >= (3, 10): from typing import TypeGuard else: - from typing_extensions import TypeGuard + from typing import TypeGuard if sys.version_info >= (3, 11): from typing import LiteralString else: - from typing_extensions import LiteralString + from typing import LiteralString __all__ = [ "Counter", diff --git a/psycopg/_pipeline.py b/psycopg/_pipeline.py index c818d86..ef9358e 100644 --- a/psycopg/_pipeline.py +++ b/psycopg/_pipeline.py @@ -7,7 +7,7 @@ commands pipeline management import logging from types import TracebackType from typing import Any, List, Optional, Union, Tuple, Type, TypeVar, TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from . import errors as e diff --git a/psycopg/_preparing.py b/psycopg/_preparing.py index f60c0cb..cdf403f 100644 --- a/psycopg/_preparing.py +++ b/psycopg/_preparing.py @@ -7,7 +7,7 @@ Support for prepared statements from enum import IntEnum, auto from typing import Iterator, Optional, Sequence, Tuple, TYPE_CHECKING from collections import OrderedDict -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from ._compat import Deque diff --git a/psycopg/_struct.py b/psycopg/_struct.py index 28a6084..a57ddf6 100644 --- a/psycopg/_struct.py +++ b/psycopg/_struct.py @@ -6,7 +6,7 @@ Utility functions to deal with binary structs. import struct from typing import Callable, cast, Optional, Tuple -from typing_extensions import TypeAlias +from typing import TypeAlias from .abc import Buffer from . import errors as e diff --git a/psycopg/_transform.py b/psycopg/_transform.py index 19bd6ae..a4e3baf 100644 --- a/psycopg/_transform.py +++ b/psycopg/_transform.py @@ -7,7 +7,7 @@ Helper object to transform values between Python and PostgreSQL from typing import Any, Dict, List, Optional, Sequence, Tuple from typing import DefaultDict, TYPE_CHECKING from collections import defaultdict -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from . import postgres diff --git a/psycopg/_typeinfo.py b/psycopg/_typeinfo.py index 52d5ca7..30cba21 100644 --- a/psycopg/_typeinfo.py +++ b/psycopg/_typeinfo.py @@ -9,7 +9,7 @@ information to the adapters if needed. from enum import Enum from typing import Any, Dict, Iterator, Optional, overload from typing import Sequence, Tuple, Type, TypeVar, Union, TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from . import errors as e from .abc import AdaptContext, Query diff --git a/psycopg/abc.py b/psycopg/abc.py index 80c8fbf..6d84bf9 100644 --- a/psycopg/abc.py +++ b/psycopg/abc.py @@ -7,7 +7,7 @@ Protocol objects representing different implementations of the same classes. from typing import Any, Callable, Generator, Mapping from typing import List, Optional, Sequence, Tuple, TypeVar, Union from typing import TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from ._enums import PyFormat as PyFormat diff --git a/psycopg/connection.py b/psycopg/connection.py index 78ad577..a620da3 100644 --- a/psycopg/connection.py +++ b/psycopg/connection.py @@ -14,7 +14,7 @@ from weakref import ref, ReferenceType from warnings import warn from functools import partial from contextlib import contextmanager -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from . import errors as e --- a/psycopg/errors.py +++ b/psycopg/errors.py @@ -21,7 +21,7 @@ DBAPI-defined Exceptions are defined in from dataclasses import dataclass, field, fields from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, Tuple, Type from typing import Union, TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from asyncio import CancelledError from .pq.abc import PGconn, PGresult diff --git a/psycopg/pq/abc.py b/psycopg/pq/abc.py index 9c45f64..c28c57c 100644 --- a/psycopg/pq/abc.py +++ b/psycopg/pq/abc.py @@ -6,7 +6,7 @@ Protocol objects to represent objects exposed by different pq implementations. from typing import Any, Callable, List, Optional, Sequence, Tuple from typing import Union, TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from ._enums import Format, Trace from .._compat import Protocol diff --git a/psycopg/rows.py b/psycopg/rows.py index cb28b57..68fd23b 100644 --- a/psycopg/rows.py +++ b/psycopg/rows.py @@ -8,7 +8,7 @@ import functools from typing import Any, Callable, Dict, List, Optional, NamedTuple, NoReturn from typing import TYPE_CHECKING, Sequence, Tuple, Type, TypeVar from collections import namedtuple -from typing_extensions import TypeAlias +from typing import TypeAlias from . import pq from . import errors as e diff --git a/psycopg/types/enum.py b/psycopg/types/enum.py index d3c7387..e602b0e 100644 --- a/psycopg/types/enum.py +++ b/psycopg/types/enum.py @@ -4,7 +4,7 @@ Adapters for the enum type. from enum import Enum from typing import Any, Dict, Generic, Optional, Mapping, Sequence from typing import Tuple, Type, TypeVar, Union, cast -from typing_extensions import TypeAlias +from typing import TypeAlias from .. import postgres from .. import errors as e diff --git a/psycopg/types/hstore.py b/psycopg/types/hstore.py index e1ab1d5..eaa8dfc 100644 --- a/psycopg/types/hstore.py +++ b/psycopg/types/hstore.py @@ -6,7 +6,7 @@ Dict to hstore adaptation import re from typing import Dict, List, Optional -from typing_extensions import TypeAlias +from typing import TypeAlias from .. import errors as e from .. import postgres diff --git a/psycopg/types/net.py b/psycopg/types/net.py index 2f2c05b..fc8271b 100644 --- a/psycopg/types/net.py +++ b/psycopg/types/net.py @@ -5,7 +5,7 @@ Adapters for network types. # Copyright (C) 2020 The Psycopg Team from typing import Callable, Optional, Type, Union, TYPE_CHECKING -from typing_extensions import TypeAlias +from typing import TypeAlias from .. import postgres from ..pq import Format