Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis: Add missing exported names #10151

Merged
merged 2 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stubs/redis/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ redis.sentinel.Sentinel.slave_for
# Metaclass differs:
redis.RedisCluster
redis.asyncio.Redis
redis.asyncio.RedisCluster
redis.asyncio.client.MonitorCommandInfo
redis.asyncio.client.Pipeline
redis.asyncio.client.Redis
Expand Down
5 changes: 4 additions & 1 deletion stubs/redis/redis/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import client, connection, credentials, exceptions, sentinel, utils
from . import backoff, client, connection, credentials, exceptions, sentinel, utils
from .cluster import RedisCluster as RedisCluster

__all__ = [
Expand All @@ -13,6 +13,7 @@ __all__ = [
"CredentialProvider",
"DataError",
"from_url",
"default_backoff",
"InvalidResponse",
"PubSubError",
"ReadOnlyError",
Expand All @@ -32,6 +33,8 @@ __all__ = [
"WatchError",
]

default_backoff = backoff.default_backoff

Redis = client.Redis

BlockingConnectionPool = connection.BlockingConnectionPool
Expand Down
6 changes: 6 additions & 0 deletions stubs/redis/redis/asyncio/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from redis.asyncio.client import Redis as Redis, StrictRedis as StrictRedis
from redis.asyncio.cluster import RedisCluster as RedisCluster
from redis.asyncio.connection import (
BlockingConnectionPool as BlockingConnectionPool,
Connection as Connection,
ConnectionPool as ConnectionPool,
SSLConnection as SSLConnection,
UnixDomainSocketConnection as UnixDomainSocketConnection,
)
from redis.asyncio.parser import CommandsParser as CommandsParser
from redis.asyncio.sentinel import (
Sentinel as Sentinel,
SentinelConnectionPool as SentinelConnectionPool,
SentinelManagedConnection as SentinelManagedConnection,
SentinelManagedSSLConnection as SentinelManagedSSLConnection,
)
from redis.asyncio.utils import from_url as from_url
from redis.backoff import default_backoff as default_backoff
from redis.exceptions import (
AuthenticationError as AuthenticationError,
AuthenticationWrongNumberOfArgsError as AuthenticationWrongNumberOfArgsError,
Expand All @@ -35,15 +38,18 @@ __all__ = [
"BlockingConnectionPool",
"BusyLoadingError",
"ChildDeadlockedError",
"CommandsParser",
"Connection",
"ConnectionError",
"ConnectionPool",
"DataError",
"from_url",
"default_backoff",
"InvalidResponse",
"PubSubError",
"ReadOnlyError",
"Redis",
"RedisCluster",
"RedisError",
"ResponseError",
"Sentinel",
Expand Down
2 changes: 2 additions & 0 deletions stubs/redis/redis/backoff.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ class EqualJitterBackoff(AbstractBackoff):
class DecorrelatedJitterBackoff(AbstractBackoff):
def __init__(self, cap: float = 0.512, base: float = 0.008) -> None: ...
def compute(self, failures: int) -> float: ...

def default_backoff() -> EqualJitterBackoff: ...