[redis] Update to 4.5.1 (#9697)

Also add a few argument defaults
This commit is contained in:
Sebastian Rittau
2023-02-10 12:10:37 +01:00
committed by GitHub
parent 8e0b56f12c
commit 39487a8bab
8 changed files with 82 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
version = "4.4.0"
version = "4.5.1"
# Requires a version of cryptography with a `py.typed` file
requires = ["types-pyOpenSSL", "cryptography>=35.0.0"]

View File

@@ -232,9 +232,10 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
keys: Sequence[str] | None = ...,
channels: Iterable[ChannelT] | None = ...,
selectors: Iterable[tuple[str, KeyT]] | None = ...,
reset: bool = ...,
reset_keys: bool = ...,
reset_passwords: bool = ...,
reset: bool = False,
reset_keys: bool = False,
reset_channels: bool = False,
reset_passwords: bool = False,
**kwargs: _CommandOptions,
) -> Pipeline[_StrType]: ...
def acl_users(self, **kwargs: _CommandOptions) -> Any: ... # type: ignore[override]

View File

@@ -1,8 +1,9 @@
import asyncio
import enum
import ssl
from _typeshed import Incomplete
from collections.abc import Callable, Iterable, Mapping
from typing import Any, Protocol
from typing import Any, Protocol, overload
from typing_extensions import Literal, TypeAlias, TypedDict
from redis import RedisError
@@ -132,7 +133,12 @@ class Connection:
async def check_health(self) -> None: ...
async def send_packed_command(self, command: bytes | str | Iterable[bytes], check_health: bool = ...): ...
async def send_command(self, *args, **kwargs) -> None: ...
async def read_response(self, disable_decoding: bool = ..., timeout: float | None = ...): ...
@overload
async def read_response(self, *, timeout: float) -> Incomplete | None: ...
@overload
async def read_response(self, disable_decoding: bool, timeout: float) -> Incomplete | None: ...
@overload
async def read_response(self, disable_decoding: bool = False, timeout: None = None): ...
def pack_command(self, *args: EncodableT) -> list[bytes]: ...
def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> list[bytes]: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections.abc import AsyncIterator, Iterable, Mapping, Sequence
from typing import Any
from typing import Any, overload
from redis.asyncio.client import Redis
from redis.asyncio.connection import Connection, ConnectionPool, SSLConnection
@@ -16,7 +16,12 @@ class SentinelManagedConnection(Connection):
def __init__(self, **kwargs) -> None: ...
async def connect_to(self, address) -> None: ...
async def connect(self): ...
async def read_response(self, disable_decoding: bool = ...): ... # type: ignore[override]
@overload
async def read_response(self, *, timeout: float) -> Incomplete | None: ...
@overload
async def read_response(self, disable_decoding: bool, timeout: float) -> Incomplete | None: ...
@overload
async def read_response(self, disable_decoding: bool = False, timeout: None = None): ...
class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ...

View File

@@ -428,9 +428,11 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
keys: Sequence[str] | None = ...,
channels: Iterable[ChannelT] | None = ...,
selectors: Iterable[tuple[str, KeyT]] | None = ...,
reset: bool = ...,
reset_keys: bool = ...,
reset_passwords: bool = ...,
reset: bool = False,
reset_keys: bool = False,
reset_channels: bool = False,
reset_passwords: bool = False,
**kwargs: _CommandOptions,
) -> Pipeline[_StrType]: ...
def acl_users(self) -> Pipeline[_StrType]: ... # type: ignore[override]
def acl_whoami(self) -> Pipeline[_StrType]: ... # type: ignore[override]

View File

@@ -136,16 +136,18 @@ class NodesManager:
startup_nodes: dict[str, ClusterNode]
default_node: ClusterNode | None
from_url: bool
connection_kwargs: dict[str, Any]
connection_pool_class: type[ConnectionPool]
connection_kwargs: dict[str, Incomplete] # TODO: could be a TypedDict
read_load_balancer: LoadBalancer
def __init__(
self,
startup_nodes: Iterable[ClusterNode],
from_url: bool = ...,
require_full_coverage: bool = ...,
lock: Lock | None = ...,
dynamic_startup_nodes: bool = ...,
**kwargs: Any,
from_url: bool = False,
require_full_coverage: bool = False,
lock: Lock | None = None,
dynamic_startup_nodes: bool = True,
connection_pool_class: type[ConnectionPool] = ...,
**kwargs, # TODO: same type as connection_kwargs
) -> None: ...
def get_node(
self, host: str | None = ..., port: int | str | None = ..., node_name: str | None = ...

View File

@@ -35,9 +35,10 @@ class ACLCommands(Generic[_StrType]):
keys: Sequence[str] | None = ...,
channels: Iterable[ChannelT] | None = ...,
selectors: Iterable[tuple[str, KeyT]] | None = ...,
reset: bool = ...,
reset_keys: bool = ...,
reset_passwords: bool = ...,
reset: bool = False,
reset_keys: bool = False,
reset_channels: bool = False,
reset_passwords: bool = False,
**kwargs: _CommandOptions,
) -> bool: ...
def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ...
@@ -66,9 +67,10 @@ class AsyncACLCommands(Generic[_StrType]):
keys: Sequence[str] | None = ...,
channels: Iterable[ChannelT] | None = ...,
selectors: Iterable[tuple[str, KeyT]] | None = ...,
reset: bool = ...,
reset_keys: bool = ...,
reset_passwords: bool = ...,
reset: bool = False,
reset_keys: bool = False,
reset_channels: bool = False,
reset_passwords: bool = False,
**kwargs: _CommandOptions,
) -> bool: ...
async def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ...

View File

@@ -38,13 +38,14 @@ class SocketBuffer:
bytes_read: int
socket_timeout: float | None
def __init__(self, socket: socket, socket_read_size: int, socket_timeout: float | None) -> None: ...
@property
def length(self) -> int: ...
def unread_bytes(self) -> int: ...
def can_read(self, timeout: float | None) -> bool: ...
def read(self, length: int) -> bytes: ...
def readline(self) -> bytes: ...
def get_pos(self) -> int: ...
def rewind(self, pos: int) -> None: ...
def purge(self) -> None: ...
def close(self) -> None: ...
def can_read(self, timeout: float | None) -> bool: ...
class PythonParser(BaseParser):
encoding: str
@@ -101,28 +102,29 @@ class Connection:
health_check_interval: int
def __init__(
self,
host: str = ...,
port: int = ...,
db: int = ...,
password: str | None = ...,
socket_timeout: float | None = ...,
socket_connect_timeout: float | None = ...,
socket_keepalive: bool = ...,
socket_keepalive_options: Mapping[str, int | str] | None = ...,
socket_type: int = ...,
retry_on_timeout: bool = ...,
host: str = "localhost",
port: int = 6379,
db: int = 0,
password: str | None = None,
socket_timeout: float | None = None,
socket_connect_timeout: float | None = None,
socket_keepalive: bool = False,
socket_keepalive_options: Mapping[str, int | str] | None = None,
socket_type: int = 0,
retry_on_timeout: bool = False,
retry_on_error: list[type[Exception]] = ...,
encoding: str = ...,
encoding_errors: str = ...,
decode_responses: bool = ...,
encoding: str = "utf-8",
encoding_errors: str = "strict",
decode_responses: bool = False,
parser_class: type[BaseParser] = ...,
socket_read_size: int = ...,
health_check_interval: int = ...,
client_name: str | None = ...,
username: str | None = ...,
retry: Retry | None = ...,
redis_connect_func: _ConnectFunc | None = ...,
credential_provider: CredentialProvider | None = ...,
socket_read_size: int = 65536,
health_check_interval: int = 0,
client_name: str | None = None,
username: str | None = None,
retry: Retry | None = None,
redis_connect_func: _ConnectFunc | None = None,
credential_provider: CredentialProvider | None = None,
command_packer: Incomplete | None = None,
) -> None: ...
def __del__(self) -> None: ...
def register_connect_callback(self, callback: _ConnectFunc) -> None: ...
@@ -173,23 +175,24 @@ class UnixDomainSocketConnection(Connection):
path: str
def __init__(
self,
path: str = ...,
db: int = ...,
username: str | None = ...,
password: str | None = ...,
socket_timeout: float | None = ...,
encoding: str = ...,
encoding_errors: str = ...,
decode_responses: bool = ...,
retry_on_timeout: bool = ...,
path: str = "",
db: int = 0,
username: str | None = None,
password: str | None = None,
socket_timeout: float | None = None,
encoding: str = "utf-8",
encoding_errors: str = "strict",
decode_responses: bool = False,
retry_on_timeout: bool = False,
retry_on_error: list[type[Exception]] = ...,
parser_class: type[BaseParser] = ...,
socket_read_size: int = ...,
health_check_interval: int = ...,
client_name: str | None = ...,
retry: Retry | None = ...,
redis_connect_func: _ConnectFunc | None = ...,
credential_provider: CredentialProvider | None = ...,
socket_read_size: int = 65536,
health_check_interval: int = 0,
client_name: str | None = None,
retry: Retry | None = None,
redis_connect_func: _ConnectFunc | None = None,
credential_provider: CredentialProvider | None = None,
command_packer: Incomplete | None = None,
) -> None: ...
# TODO: make generic on `connection_class`