diff --git a/stubs/redis/redis/asyncio/client.pyi b/stubs/redis/redis/asyncio/client.pyi index c3da0df44..24b07973f 100644 --- a/stubs/redis/redis/asyncio/client.pyi +++ b/stubs/redis/redis/asyncio/client.pyi @@ -3,6 +3,7 @@ from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Mappin from typing import Any, ClassVar, Generic, NoReturn, Protocol from typing_extensions import TypeAlias, TypedDict +from redis import RedisError from redis.asyncio.connection import ConnectCallbackT, Connection, ConnectionPool from redis.asyncio.lock import Lock from redis.asyncio.retry import Retry @@ -45,6 +46,7 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy encoding_errors: str = ..., decode_responses: bool = ..., retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | None = ..., ssl: bool = ..., ssl_keyfile: str | None = ..., ssl_certfile: str | None = ..., diff --git a/stubs/redis/redis/asyncio/connection.pyi b/stubs/redis/redis/asyncio/connection.pyi index c0a85f5bd..84fdaa23c 100644 --- a/stubs/redis/redis/asyncio/connection.pyi +++ b/stubs/redis/redis/asyncio/connection.pyi @@ -5,6 +5,7 @@ from collections.abc import Callable, Iterable, Mapping from typing import Any, Protocol from typing_extensions import TypeAlias, TypedDict +from redis import RedisError from redis.asyncio.retry import Retry from redis.exceptions import ResponseError from redis.typing import EncodableT, EncodedT @@ -108,7 +109,8 @@ class Connection: socket_keepalive_options: Any socket_type: Any retry_on_timeout: Any - retry: Any + retry_on_error: list[type[RedisError]] + retry: Retry health_check_interval: Any next_health_check: int ssl_context: Any @@ -127,6 +129,7 @@ class Connection: socket_keepalive_options: Mapping[int, int | bytes] | None = ..., socket_type: int = ..., retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | _Sentinel = ..., encoding: str = ..., encoding_errors: str = ..., decode_responses: bool = ..., @@ -211,6 +214,7 @@ class UnixDomainSocketConnection(Connection): socket_timeout: Any socket_connect_timeout: Any retry_on_timeout: Any + retry_on_error: list[type[RedisError]] retry: Any health_check_interval: Any next_health_check: int @@ -229,6 +233,7 @@ class UnixDomainSocketConnection(Connection): encoding_errors: str = ..., decode_responses: bool = ..., retry_on_timeout: bool = ..., + retry_on_error: list[type[RedisError]] | _Sentinel = ..., parser_class: type[BaseParser] = ..., socket_read_size: int = ..., health_check_interval: float = ..., diff --git a/stubs/redis/redis/asyncio/retry.pyi b/stubs/redis/redis/asyncio/retry.pyi index 4d847684c..f6c2f9594 100644 --- a/stubs/redis/redis/asyncio/retry.pyi +++ b/stubs/redis/redis/asyncio/retry.pyi @@ -1,4 +1,4 @@ -from collections.abc import Awaitable, Callable +from collections.abc import Awaitable, Callable, Iterable from typing import Any, TypeVar from redis.backoff import AbstractBackoff @@ -8,4 +8,5 @@ _T = TypeVar("_T") class Retry: def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[RedisError], ...] = ...) -> None: ... + def update_supported_errors(self, specified_errors: Iterable[type[RedisError]]) -> None: ... async def call_with_retry(self, do: Callable[[], Awaitable[_T]], fail: Callable[[RedisError], Any]) -> _T: ... diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index 3977da80a..287651c1c 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -6,6 +6,8 @@ from types import TracebackType from typing import Any, ClassVar, Generic, Pattern, TypeVar, overload from typing_extensions import Literal, TypeAlias +from redis import RedisError + from .commands import CoreCommands, RedisModuleCommands, SentinelCommands from .connection import ConnectionPool, _ConnectFunc, _ConnectionPoolOptions from .lock import Lock @@ -164,7 +166,7 @@ class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], Sentinel errors: str | None, decode_responses: Literal[True], retry_on_timeout: bool = ..., - retry_on_error=..., + retry_on_error: list[type[RedisError]] | None = ..., ssl: bool = ..., ssl_keyfile: str | None = ..., ssl_certfile: str | None = ..., diff --git a/stubs/redis/redis/cluster.pyi b/stubs/redis/redis/cluster.pyi index bd3102851..35d772cab 100644 --- a/stubs/redis/redis/cluster.pyi +++ b/stubs/redis/redis/cluster.pyi @@ -53,14 +53,15 @@ class RedisCluster(RedisClusterCommands[_StrType], Generic[_StrType]): commands_parser: Any def __init__( self, - host: Any | None = ..., + host: Incomplete | None = ..., port: int = ..., - startup_nodes: Any | None = ..., + startup_nodes: Incomplete | None = ..., cluster_error_retry_attempts: int = ..., require_full_coverage: bool = ..., reinitialize_steps: int = ..., read_from_replicas: bool = ..., - url: Any | None = ..., + dynamic_startup_nodes: bool = ..., + url: Incomplete | None = ..., **kwargs, ) -> None: ... def __enter__(self): ... @@ -125,7 +126,13 @@ class NodesManager: connection_kwargs: Any read_load_balancer: Any def __init__( - self, startup_nodes, from_url: bool = ..., require_full_coverage: bool = ..., lock: Any | None = ..., **kwargs + self, + startup_nodes, + from_url: bool = ..., + require_full_coverage: bool = ..., + lock: Incomplete | None = ..., + dynamic_startup_nodes: bool = ..., + **kwargs, ) -> None: ... def get_node(self, host: Any | None = ..., port: Any | None = ..., node_name: Any | None = ...): ... def update_moved_exception(self, exception) -> None: ... diff --git a/stubs/redis/redis/lock.pyi b/stubs/redis/redis/lock.pyi index c35339926..7d6bc94fa 100644 --- a/stubs/redis/redis/lock.pyi +++ b/stubs/redis/redis/lock.pyi @@ -32,7 +32,6 @@ class Lock: ) -> bool | None: ... def acquire( self, - *, sleep: float | None = ..., blocking: bool | None = ..., blocking_timeout: float | None = ...,