mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 19:01:15 +08:00
Fix various issues in redis.client (#6464)
This commit is contained in:
@@ -1,22 +1 @@
|
||||
redis.client.Pipeline.pubsub
|
||||
redis.client.Pipeline.scan
|
||||
redis.client.Pipeline.scan_iter
|
||||
redis.client.Pipeline.shutdown
|
||||
redis.client.Pipeline.sscan
|
||||
redis.client.Pipeline.transaction
|
||||
redis.client.Pipeline.zinterstore
|
||||
redis.client.Pipeline.zrevrange
|
||||
redis.client.Pipeline.zrevrangebylex
|
||||
redis.client.Pipeline.zrevrangebyscore
|
||||
redis.client.Pipeline.zunionstore
|
||||
redis.client.PubSub.encode
|
||||
redis.client.PubSub.execute_command
|
||||
redis.client.PubSub.parse_response
|
||||
redis.client.PubSub.run_in_thread
|
||||
redis.client.Redis.hscan
|
||||
redis.client.Redis.pubsub
|
||||
redis.client.Redis.scan
|
||||
redis.client.Redis.scan_iter
|
||||
redis.client.Redis.shutdown
|
||||
redis.client.Redis.sscan
|
||||
redis.client.pairs_to_dict
|
||||
redis.client.Pipeline.transaction # instance attribute has same name as superclass method
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
import builtins
|
||||
import threading
|
||||
from _typeshed import SupportsItems
|
||||
from _typeshed import Self, SupportsItems
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Callable, Dict, Generic, Iterable, Iterator, Mapping, Pattern, Sequence, Type, TypeVar, Union, overload
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
ClassVar,
|
||||
Dict,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
Pattern,
|
||||
Sequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .commands import CoreCommands, RedisModuleCommands, SentinelCommands
|
||||
@@ -44,7 +59,7 @@ def parse_sentinel_master(response): ...
|
||||
def parse_sentinel_masters(response): ...
|
||||
def parse_sentinel_slaves_and_sentinels(response): ...
|
||||
def parse_sentinel_get_master(response): ...
|
||||
def pairs_to_dict(response): ...
|
||||
def pairs_to_dict(response, decode_keys: bool = ..., decode_string_values: bool = ...): ...
|
||||
def pairs_to_dict_typed(response, type_info): ...
|
||||
def zset_score_pairs(response, **options): ...
|
||||
def sort_return_tuples(response, **options): ...
|
||||
@@ -263,7 +278,7 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener
|
||||
lock_class: Type[_LockType],
|
||||
thread_local: bool = ...,
|
||||
) -> _LockType: ...
|
||||
def pubsub(self, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ...
|
||||
def pubsub(self, *, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ...
|
||||
def execute_command(self, *args, **options): ...
|
||||
def parse_response(self, connection, command_name, **options): ...
|
||||
# TODO: Most of the following methods must be moved to the command classes.
|
||||
@@ -281,7 +296,7 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener
|
||||
def object(self, infotype, key): ...
|
||||
def ping(self) -> bool: ...
|
||||
def save(self) -> bool: ...
|
||||
def shutdown(self): ...
|
||||
def shutdown(self, save: bool = ..., nosave: bool = ...) -> None: ...
|
||||
def slaveof(self, host=..., port=...): ...
|
||||
def slowlog_get(self, num=...): ...
|
||||
def slowlog_len(self): ...
|
||||
@@ -375,14 +390,18 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener
|
||||
store: _Key,
|
||||
groups: bool = ...,
|
||||
) -> int: ...
|
||||
def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> tuple[int, list[_StrType]]: ...
|
||||
def scan_iter(self, match: str | None = ..., count: int | None = ...) -> Iterator[_StrType]: ...
|
||||
def sscan(self, name: _Key, cursor: int = ..., match: str = ..., count: int = ...) -> tuple[int, list[_StrType]]: ...
|
||||
def sscan_iter(self, name, match=..., count=...): ...
|
||||
def scan(
|
||||
self, cursor: int = ..., match: _Key | None = ..., count: int | None = ..., _type: str | None = ...
|
||||
) -> tuple[int, list[_StrType]]: ...
|
||||
def scan_iter(self, match: str | None = ..., count: int | None = ..., _type: str | None = ...) -> Iterator[_StrType]: ...
|
||||
def sscan(
|
||||
self, name: _Key, cursor: int = ..., match: str | None = ..., count: int | None = ...
|
||||
) -> tuple[int, list[_StrType]]: ...
|
||||
def sscan_iter(self, name: _Key, match: str | None = ..., count: int | None = ...): ...
|
||||
def hscan(
|
||||
self, name: _Key, cursor: int = ..., match: str = ..., count: int = ...
|
||||
self, name: _Key, cursor: int = ..., match: str | None = ..., count: int | None = ...
|
||||
) -> tuple[int, dict[_StrType, _StrType]]: ...
|
||||
def hscan_iter(self, name, match=..., count=...): ...
|
||||
def hscan_iter(self, name: _Key, match: str | None = ..., count: int | None = ...): ...
|
||||
def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...): ...
|
||||
def zscan_iter(self, name, match=..., count=..., score_cast_func=...): ...
|
||||
def sadd(self, name: _Key, *values: _Value) -> int: ...
|
||||
@@ -445,27 +464,28 @@ class Redis(RedisModuleCommands, CoreCommands[_StrType], SentinelCommands, Gener
|
||||
StrictRedis = Redis
|
||||
|
||||
class PubSub:
|
||||
PUBLISH_MESSAGE_TYPES: Any
|
||||
UNSUBSCRIBE_MESSAGE_TYPES: Any
|
||||
PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, str]]
|
||||
UNSUBSCRIBE_MESSAGE_TYPES: ClassVar[tuple[str, str]]
|
||||
HEALTH_CHECK_MESSAGE: ClassVar[str]
|
||||
connection_pool: Any
|
||||
shard_hint: Any
|
||||
ignore_subscribe_messages: Any
|
||||
connection: Any
|
||||
encoding: Any
|
||||
encoding_errors: Any
|
||||
decode_responses: Any
|
||||
def __init__(self, connection_pool, shard_hint=..., ignore_subscribe_messages=...) -> None: ...
|
||||
encoder: Any
|
||||
health_check_response: Any
|
||||
def __init__(self, connection_pool, shard_hint=..., ignore_subscribe_messages: bool = ...) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
|
||||
def __del__(self): ...
|
||||
channels: Any
|
||||
patterns: Any
|
||||
def reset(self): ...
|
||||
def close(self) -> None: ...
|
||||
def on_connect(self, connection): ...
|
||||
def encode(self, value): ...
|
||||
@property
|
||||
def subscribed(self): ...
|
||||
def execute_command(self, *args, **kwargs): ...
|
||||
def parse_response(self, block=...): ...
|
||||
def execute_command(self, *args): ...
|
||||
def parse_response(self, block: bool = ..., timeout: float = ...): ...
|
||||
def psubscribe(self, *args: _Key, **kwargs: Callable[[Any], None]): ...
|
||||
def punsubscribe(self, *args: _Key) -> None: ...
|
||||
def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ...
|
||||
@@ -473,7 +493,7 @@ class PubSub:
|
||||
def listen(self): ...
|
||||
def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...) -> dict[str, Any] | None: ...
|
||||
def handle_message(self, response, ignore_subscribe_messages: bool = ...) -> dict[str, Any] | None: ...
|
||||
def run_in_thread(self, sleep_time=...): ...
|
||||
def run_in_thread(self, sleep_time: float = ..., daemon: bool = ..., exception_handler: Any | None = ...): ...
|
||||
def ping(self, message: _Value | None = ...) -> None: ...
|
||||
|
||||
class PubSubWorkerThread(threading.Thread):
|
||||
@@ -520,7 +540,6 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def set_response_callback(self, command, callback): ...
|
||||
def pipeline(self, transaction: bool = ..., shard_hint: Any = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def lock(self, name, timeout=..., sleep=..., blocking_timeout=..., lock_class=..., thread_local=...): ...
|
||||
def pubsub(self, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ...
|
||||
def acl_cat(self, category: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def acl_deluser(self, username: str) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def acl_genpass(self, bits: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
@@ -574,7 +593,6 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def sentinel_sentinels(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def sentinel_set(self, name, option, value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def sentinel_slaves(self, service_name) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def shutdown(self) -> None: ...
|
||||
def slaveof(self, host=..., port=...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def slowlog_get(self, num=...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def slowlog_len(self) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
@@ -668,10 +686,10 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
store: _Key | None = ...,
|
||||
groups: bool = ...,
|
||||
) -> Pipeline[_StrType]: ...
|
||||
def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def scan_iter(self, match: str | None = ..., count: int | None = ...) -> Iterator[Any]: ...
|
||||
def sscan(self, name: _Key, cursor: int = ..., match: str = ..., count: int = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def sscan_iter(self, name, match=..., count=...) -> Iterator[Any]: ...
|
||||
def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ..., _type: str | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def scan_iter(self, match: str | None = ..., count: int | None = ..., _type: str | None = ...) -> Iterator[Any]: ...
|
||||
def sscan(self, name: _Key, cursor: int = ..., match: str | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def sscan_iter(self, name: _Key, match: str | None = ..., count: int | None = ...) -> Iterator[Any]: ...
|
||||
def hscan(self, name: _Key, cursor: int = ..., match: str | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def hscan_iter(self, name, match=..., count=...) -> Iterator[Any]: ...
|
||||
def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
@@ -725,7 +743,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def zcard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zincrby(self, name: _Key, amount: float, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zpopmax(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zpopmin(self, name: _Key, count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
@@ -761,30 +779,24 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
|
||||
def zremrangebyrank(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zrevrange( # type: ignore[override]
|
||||
self,
|
||||
name: _Key,
|
||||
start: int,
|
||||
end: int,
|
||||
desc: bool = ...,
|
||||
withscores: bool = ...,
|
||||
score_cast_func: Callable[[Any], Any] = ...,
|
||||
self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ...
|
||||
) -> Pipeline[_StrType]: ...
|
||||
def zrevrangebyscore( # type: ignore[override]
|
||||
self,
|
||||
name: _Key,
|
||||
min: _Value,
|
||||
max: _Value,
|
||||
min: _Value,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
withscores: bool = ...,
|
||||
score_cast_func: Callable[[Any], Any] = ...,
|
||||
) -> Pipeline[_StrType]: ...
|
||||
def zrevrangebylex( # type: ignore[override]
|
||||
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...
|
||||
self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ...
|
||||
) -> Pipeline[_StrType]: ...
|
||||
def zrevrank(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zscore(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def pfadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def pfcount(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
def pfmerge(self, dest: _Key, *sources: _Key) -> Pipeline[_StrType]: ... # type: ignore[override]
|
||||
|
||||
Reference in New Issue
Block a user