Remove redundant inheritances from Generic and various typing protocols (#10981)

This commit is contained in:
Alex Waygood
2023-11-06 13:00:25 +00:00
committed by GitHub
parent c8073493fc
commit 8023ba764a
9 changed files with 16 additions and 25 deletions

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete, Unused
from collections.abc import AsyncIterator, Awaitable, Callable, Generator, Iterable, Mapping, MutableMapping, Sequence
from datetime import datetime, timedelta
from types import TracebackType
from typing import Any, ClassVar, Generic, NoReturn, Protocol, overload
from typing import Any, ClassVar, NoReturn, Protocol, overload
from typing_extensions import Literal, Self, TypeAlias, TypedDict
from redis import RedisError
@@ -24,7 +24,7 @@ class AsyncResponseCallbackProtocol(Protocol):
ResponseCallbackT: TypeAlias = ResponseCallbackProtocol | AsyncResponseCallbackProtocol
class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], AsyncSentinelCommands, Generic[_StrType]):
class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], AsyncSentinelCommands):
response_callbacks: MutableMapping[str | bytes, ResponseCallbackT]
auto_close_connection_pool: bool
connection_pool: Any

View File

@@ -4,7 +4,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from datetime import datetime, timedelta
from re import Pattern
from types import TracebackType
from typing import Any, ClassVar, Generic, TypeVar, overload
from typing import Any, ClassVar, TypeVar, overload
from typing_extensions import Literal, Self, TypeAlias
from redis import RedisError
@@ -76,7 +76,7 @@ _LockType = TypeVar("_LockType")
class AbstractRedis:
RESPONSE_CALLBACKS: dict[str, Any]
class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Generic[_StrType]):
class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], SentinelCommands):
@overload
@classmethod
def from_url(

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete, Unused
from collections.abc import Callable, Iterable, Sequence
from threading import Lock
from types import TracebackType
from typing import Any, ClassVar, Generic, NoReturn, Protocol
from typing import Any, ClassVar, NoReturn, Protocol
from typing_extensions import Literal, Self
from redis.client import CaseInsensitiveDict, PubSub, Redis, _ParseResponseOptions
@@ -45,7 +45,7 @@ class AbstractRedisCluster:
RESULT_CALLBACKS: ClassVar[dict[str, Callable[[Incomplete, Incomplete], Incomplete]]]
ERRORS_ALLOW_RETRY: ClassVar[tuple[type[RedisError], ...]]
class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType], Generic[_StrType]):
class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType]):
user_on_connect_func: Callable[[Connection], object] | None
encoder: Encoder
cluster_error_retry_attempts: int

View File

@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Generic, NoReturn
from typing import NoReturn
from .core import ACLCommands, DataAccessCommands, ManagementCommands, PubSubCommands, _StrType
@@ -31,12 +31,7 @@ class ClusterDataAccessCommands(DataAccessCommands[_StrType]):
): ...
class RedisClusterCommands(
ClusterMultiKeyCommands,
ClusterManagementCommands,
ACLCommands[_StrType],
PubSubCommands,
ClusterDataAccessCommands[_StrType],
Generic[_StrType],
ClusterMultiKeyCommands, ClusterManagementCommands, ACLCommands[_StrType], PubSubCommands, ClusterDataAccessCommands[_StrType]
):
def cluster_addslots(self, target_node, *slots): ...
def cluster_countkeysinslot(self, slot_id): ...

View File

@@ -1705,7 +1705,6 @@ class DataAccessCommands(
SetCommands[_StrType],
StreamCommands,
SortedSetCommands[_StrType],
Generic[_StrType],
): ...
class AsyncDataAccessCommands(
AsyncBasicKeyCommands[_StrType],
@@ -1717,7 +1716,6 @@ class AsyncDataAccessCommands(
AsyncSetCommands[_StrType],
AsyncStreamCommands,
AsyncSortedSetCommands[_StrType],
Generic[_StrType],
): ...
class CoreCommands(
ACLCommands[_StrType],
@@ -1727,7 +1725,6 @@ class CoreCommands(
ModuleCommands,
PubSubCommands,
ScriptCommands[_StrType],
Generic[_StrType],
): ...
class AsyncCoreCommands(
AsyncACLCommands[_StrType],
@@ -1738,5 +1735,4 @@ class AsyncCoreCommands(
AsyncPubSubCommands,
AsyncScriptCommands[_StrType],
AsyncFunctionCommands,
Generic[_StrType],
): ...

View File

@@ -31,7 +31,7 @@ class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): ...
_T = TypeVar("_T")
class tqdm(Iterable[_T], Comparable, Generic[_T]):
class tqdm(Comparable, Generic[_T]):
monitor_interval: ClassVar[int]
monitor: ClassVar[TMonitor | None]