diff --git a/redis/_parsers/hiredis.py b/redis/_parsers/hiredis.py index b3247b71ec..d52654778d 100644 --- a/redis/_parsers/hiredis.py +++ b/redis/_parsers/hiredis.py @@ -1,15 +1,13 @@ import asyncio import socket import sys -from typing import Callable, List, Optional, Union +from typing import Callable, List, Optional, TypedDict, Union if sys.version_info.major >= 3 and sys.version_info.minor >= 11: from asyncio import timeout as async_timeout else: from async_timeout import timeout as async_timeout -from redis.compat import TypedDict - from ..exceptions import ConnectionError, InvalidResponse, RedisError from ..typing import EncodableT from ..utils import HIREDIS_AVAILABLE diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index acc89941f2..d3c0b52ce7 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -15,9 +15,11 @@ Mapping, MutableMapping, Optional, + Protocol, Set, Tuple, Type, + TypedDict, TypeVar, Union, cast, @@ -49,7 +51,6 @@ AsyncSentinelCommands, list_or_args, ) -from redis.compat import Protocol, TypedDict from redis.credentials import CredentialProvider from redis.exceptions import ( ConnectionError, diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 77312211a9..babb0f0af5 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -17,9 +17,11 @@ List, Mapping, Optional, + Protocol, Set, Tuple, Type, + TypedDict, TypeVar, Union, ) @@ -34,7 +36,6 @@ from redis.asyncio.retry import Retry from redis.backoff import NoBackoff -from redis.compat import Protocol, TypedDict from redis.connection import DEFAULT_RESP_VERSION from redis.credentials import CredentialProvider, UsernamePasswordCredentialProvider from redis.exceptions import ( diff --git a/redis/commands/cluster.py b/redis/commands/cluster.py index 14b8741443..83d810556b 100644 --- a/redis/commands/cluster.py +++ b/redis/commands/cluster.py @@ -7,13 +7,13 @@ Iterable, Iterator, List, + Literal, Mapping, NoReturn, Optional, Union, ) -from redis.compat import Literal from redis.crc import key_slot from redis.exceptions import RedisClusterException, RedisError from redis.typing import ( diff --git a/redis/commands/core.py b/redis/commands/core.py index e73553e47e..d2ed715af0 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -13,6 +13,7 @@ Iterable, Iterator, List, + Literal, Mapping, Optional, Sequence, @@ -21,7 +22,6 @@ Union, ) -from redis.compat import Literal from redis.exceptions import ConnectionError, DataError, NoScriptError, RedisError from redis.typing import ( AbsExpiryT, diff --git a/redis/compat.py b/redis/compat.py deleted file mode 100644 index e478493467..0000000000 --- a/redis/compat.py +++ /dev/null @@ -1,6 +0,0 @@ -# flake8: noqa -try: - from typing import Literal, Protocol, TypedDict # lgtm [py/unused-import] -except ImportError: - from typing_extensions import Literal # lgtm [py/unused-import] - from typing_extensions import Protocol, TypedDict diff --git a/redis/typing.py b/redis/typing.py index 56a1e99ba7..b4cea9096f 100644 --- a/redis/typing.py +++ b/redis/typing.py @@ -7,13 +7,12 @@ Awaitable, Iterable, Mapping, + Protocol, Type, TypeVar, Union, ) -from redis.compat import Protocol - if TYPE_CHECKING: from redis._parsers import Encoder from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool diff --git a/setup.py b/setup.py index f22d809d27..47606bbac8 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,6 @@ python_requires=">=3.7", install_requires=[ 'importlib-metadata >= 1.0; python_version < "3.8"', - 'typing-extensions; python_version<"3.8"', 'async-timeout>=4.0.2; python_full_version<="3.11.2"', ], classifiers=[