mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
reds: commands from asyncio module must be async (#7820)
redis-py has introduced an asyncio module since 4.2 and almost all commands should be async if the redis.asyncio.Redis is used instead of redis.Redis. This changes adds the types for all core commands. Related to #7597
This commit is contained in:
@@ -6,7 +6,7 @@ from typing_extensions import Literal
|
||||
|
||||
from ..asyncio.client import Redis as AsyncRedis
|
||||
from ..client import _CommandOptions, _Key, _Value
|
||||
from ..typing import EncodableT, KeyT, PatternT, ScriptTextT
|
||||
from ..typing import EncodableT, KeyT, ScriptTextT
|
||||
|
||||
_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn")
|
||||
_StrType = TypeVar("_StrType", bound=str | bytes)
|
||||
@@ -40,7 +40,34 @@ class ACLCommands(Generic[_StrType]):
|
||||
def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ...
|
||||
def acl_whoami(self, **kwargs: _CommandOptions) -> str: ...
|
||||
|
||||
AsyncACLCommands = ACLCommands
|
||||
class AsyncACLCommands(Generic[_StrType]):
|
||||
async def acl_cat(self, category: str | None = ..., **kwargs: _CommandOptions) -> list[str]: ...
|
||||
async def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> int: ...
|
||||
async def acl_genpass(self, bits: int | None = ..., **kwargs: _CommandOptions) -> str: ...
|
||||
async def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any | None: ...
|
||||
async def acl_help(self, **kwargs: _CommandOptions): ...
|
||||
async def acl_list(self, **kwargs: _CommandOptions) -> list[str]: ...
|
||||
async def acl_log(self, count: int | None = ..., **kwargs: _CommandOptions): ...
|
||||
async def acl_log_reset(self, **kwargs: _CommandOptions): ...
|
||||
async def acl_load(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def acl_save(self, **kwargs: _CommandOptions): ...
|
||||
async def acl_setuser(
|
||||
self,
|
||||
username: str,
|
||||
enabled: bool = ...,
|
||||
nopass: bool = ...,
|
||||
passwords: Sequence[str] | None = ...,
|
||||
hashed_passwords: Sequence[str] | None = ...,
|
||||
categories: Sequence[str] | None = ...,
|
||||
commands: Sequence[str] | None = ...,
|
||||
keys: Sequence[str] | None = ...,
|
||||
reset: bool = ...,
|
||||
reset_keys: bool = ...,
|
||||
reset_passwords: bool = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
) -> bool: ...
|
||||
async def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ...
|
||||
async def acl_whoami(self, **kwargs: _CommandOptions) -> str: ...
|
||||
|
||||
class ManagementCommands:
|
||||
def bgrewriteaof(self, **kwargs: _CommandOptions): ...
|
||||
@@ -139,12 +166,102 @@ class ManagementCommands:
|
||||
def time(self, **kwargs: _CommandOptions): ...
|
||||
def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ...
|
||||
|
||||
class AsyncManagementCommands(ManagementCommands):
|
||||
async def command_info(self, **kwargs) -> None: ...
|
||||
async def debug_segfault(self, **kwargs) -> None: ...
|
||||
async def memory_doctor(self, **kwargs) -> None: ...
|
||||
async def memory_help(self, **kwargs) -> None: ...
|
||||
async def shutdown(self, save: bool = ..., nosave: bool = ..., **kwargs) -> None: ... # type: ignore[override]
|
||||
class AsyncManagementCommands:
|
||||
async def bgrewriteaof(self, **kwargs: _CommandOptions): ...
|
||||
async def bgsave(self, schedule: bool = ..., **kwargs: _CommandOptions): ...
|
||||
async def role(self): ...
|
||||
async def client_kill(self, address: str, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def client_kill_filter(
|
||||
self,
|
||||
_id: Any | None = ...,
|
||||
_type: Any | None = ...,
|
||||
addr: Any | None = ...,
|
||||
skipme: Any | None = ...,
|
||||
laddr: Any | None = ...,
|
||||
user: Any | None = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
): ...
|
||||
async def client_info(self, **kwargs: _CommandOptions): ...
|
||||
async def client_list(
|
||||
self, _type: str | None = ..., client_id: list[str] = ..., **kwargs: _CommandOptions
|
||||
) -> list[dict[str, str]]: ...
|
||||
async def client_getname(self, **kwargs: _CommandOptions) -> str | None: ...
|
||||
async def client_getredir(self, **kwargs: _CommandOptions): ...
|
||||
async def client_reply(self, reply, **kwargs: _CommandOptions): ...
|
||||
async def client_id(self, **kwargs: _CommandOptions) -> int: ...
|
||||
async def client_tracking_on(
|
||||
self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ...
|
||||
): ...
|
||||
async def client_tracking_off(
|
||||
self, clientid: Any | None = ..., prefix=..., bcast: bool = ..., optin: bool = ..., optout: bool = ..., noloop: bool = ...
|
||||
): ...
|
||||
async def client_tracking(
|
||||
self,
|
||||
on: bool = ...,
|
||||
clientid: Any | None = ...,
|
||||
prefix=...,
|
||||
bcast: bool = ...,
|
||||
optin: bool = ...,
|
||||
optout: bool = ...,
|
||||
noloop: bool = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
): ...
|
||||
async def client_trackinginfo(self, **kwargs: _CommandOptions): ...
|
||||
async def client_setname(self, name: str, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def client_unblock(self, client_id, error: bool = ..., **kwargs: _CommandOptions): ...
|
||||
async def client_pause(self, timeout, all: bool = ..., **kwargs: _CommandOptions): ...
|
||||
async def client_unpause(self, **kwargs: _CommandOptions): ...
|
||||
async def command(self, **kwargs: _CommandOptions): ...
|
||||
async def command_info(self, **kwargs: _CommandOptions): ...
|
||||
async def command_count(self, **kwargs: _CommandOptions): ...
|
||||
async def config_get(self, pattern: str = ..., **kwargs: _CommandOptions): ...
|
||||
async def config_set(self, name, value, **kwargs: _CommandOptions): ...
|
||||
async def config_resetstat(self, **kwargs: _CommandOptions): ...
|
||||
async def config_rewrite(self, **kwargs: _CommandOptions): ...
|
||||
async def dbsize(self, **kwargs: _CommandOptions) -> int: ...
|
||||
async def debug_object(self, key, **kwargs: _CommandOptions): ...
|
||||
async def debug_segfault(self, **kwargs: _CommandOptions): ...
|
||||
async def echo(self, value: _Value, **kwargs: _CommandOptions) -> bytes: ...
|
||||
async def flushall(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ...
|
||||
async def flushdb(self, asynchronous: bool = ..., **kwargs: _CommandOptions) -> bool: ...
|
||||
async def sync(self): ...
|
||||
async def psync(self, replicationid, offset): ...
|
||||
async def swapdb(self, first, second, **kwargs: _CommandOptions): ...
|
||||
async def select(self, index, **kwargs: _CommandOptions): ...
|
||||
async def info(self, section: _Key | None = ..., **kwargs: _CommandOptions) -> Mapping[str, Any]: ...
|
||||
async def lastsave(self, **kwargs: _CommandOptions): ...
|
||||
async def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> bytes: ...
|
||||
async def reset(self) -> None: ...
|
||||
async def migrate(
|
||||
self,
|
||||
host,
|
||||
port,
|
||||
keys,
|
||||
destination_db,
|
||||
timeout,
|
||||
copy: bool = ...,
|
||||
replace: bool = ...,
|
||||
auth: Any | None = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
): ...
|
||||
async def object(self, infotype, key, **kwargs: _CommandOptions): ...
|
||||
async def memory_doctor(self, **kwargs: _CommandOptions): ...
|
||||
async def memory_help(self, **kwargs: _CommandOptions): ...
|
||||
async def memory_stats(self, **kwargs: _CommandOptions) -> dict[str, Any]: ...
|
||||
async def memory_malloc_stats(self, **kwargs: _CommandOptions): ...
|
||||
async def memory_usage(self, key, samples: Any | None = ..., **kwargs: _CommandOptions): ...
|
||||
async def memory_purge(self, **kwargs: _CommandOptions): ...
|
||||
async def ping(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def quit(self, **kwargs: _CommandOptions): ...
|
||||
async def replicaof(self, *args, **kwargs: _CommandOptions): ...
|
||||
async def save(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def shutdown(self, save: bool = ..., nosave: bool = ..., **kwargs: _CommandOptions) -> None: ...
|
||||
async def slaveof(self, host: Any | None = ..., port: Any | None = ..., **kwargs: _CommandOptions): ...
|
||||
async def slowlog_get(self, num: Any | None = ..., **kwargs: _CommandOptions): ...
|
||||
async def slowlog_len(self, **kwargs: _CommandOptions): ...
|
||||
async def slowlog_reset(self, **kwargs: _CommandOptions): ...
|
||||
async def time(self, **kwargs: _CommandOptions): ...
|
||||
async def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ...
|
||||
|
||||
class BasicKeyCommands(Generic[_StrType]):
|
||||
def append(self, key, value): ...
|
||||
@@ -253,13 +370,112 @@ class BasicKeyCommands(Generic[_StrType]):
|
||||
def unwatch(self): ...
|
||||
def unlink(self, *names: _Key) -> int: ...
|
||||
|
||||
class AsyncBasicKeyCommands(BasicKeyCommands[_StrType], Generic[_StrType]):
|
||||
def __delitem__(self, name: KeyT): ...
|
||||
def __contains__(self, name: KeyT): ... # type: ignore[override]
|
||||
def __getitem__(self, name: KeyT): ...
|
||||
def __setitem__(self, name: KeyT, value: EncodableT): ...
|
||||
async def watch(self, *names: KeyT) -> None: ...
|
||||
async def unwatch(self) -> None: ...
|
||||
class AsyncBasicKeyCommands(Generic[_StrType]):
|
||||
async def append(self, key, value): ...
|
||||
async def bitcount(self, key: _Key, start: int | None = ..., end: int | None = ..., mode: str | None = ...) -> int: ...
|
||||
async def bitfield(self, key, default_overflow: Any | None = ...): ...
|
||||
async def bitop(self, operation, dest, *keys): ...
|
||||
async def bitpos(self, key: _Key, bit: int, start: int | None = ..., end: int | None = ..., mode: str | None = ...): ...
|
||||
async def copy(self, source, destination, destination_db: Any | None = ..., replace: bool = ...): ...
|
||||
async def decr(self, name, amount: int = ...) -> int: ...
|
||||
async def decrby(self, name, amount: int = ...) -> int: ...
|
||||
async def delete(self, *names: _Key) -> int: ...
|
||||
async def dump(self, name: _Key) -> _StrType | None: ...
|
||||
async def exists(self, *names: _Key) -> int: ...
|
||||
async def expire(
|
||||
self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...
|
||||
) -> bool: ...
|
||||
async def expireat(self, name, when, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...): ...
|
||||
async def get(self, name: _Key) -> _StrType | None: ...
|
||||
async def getdel(self, name: _Key) -> _StrType | None: ...
|
||||
async def getex(
|
||||
self,
|
||||
name,
|
||||
ex: Any | None = ...,
|
||||
px: Any | None = ...,
|
||||
exat: Any | None = ...,
|
||||
pxat: Any | None = ...,
|
||||
persist: bool = ...,
|
||||
): ...
|
||||
async def getbit(self, name: _Key, offset: int) -> int: ...
|
||||
async def getrange(self, key, start, end): ...
|
||||
async def getset(self, name, value) -> _StrType | None: ...
|
||||
async def incr(self, name: _Key, amount: int = ...) -> int: ...
|
||||
async def incrby(self, name: _Key, amount: int = ...) -> int: ...
|
||||
async def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ...
|
||||
async def keys(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[_StrType]: ...
|
||||
async def lmove(
|
||||
self, first_list: _Key, second_list: _Key, src: Literal["LEFT", "RIGHT"] = ..., dest: Literal["LEFT", "RIGHT"] = ...
|
||||
) -> _Value: ...
|
||||
async def blmove(
|
||||
self,
|
||||
first_list: _Key,
|
||||
second_list: _Key,
|
||||
timeout: float,
|
||||
src: Literal["LEFT", "RIGHT"] = ...,
|
||||
dest: Literal["LEFT", "RIGHT"] = ...,
|
||||
) -> _Value | None: ...
|
||||
async def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ...
|
||||
async def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ...
|
||||
async def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ...
|
||||
async def move(self, name: _Key, db: int) -> bool: ...
|
||||
async def persist(self, name: _Key) -> bool: ...
|
||||
async def pexpire(
|
||||
self, name: _Key, time: int | timedelta, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...
|
||||
) -> Literal[1, 0]: ...
|
||||
async def pexpireat(
|
||||
self, name: _Key, when: int | datetime, nx: bool = ..., xx: bool = ..., gt: bool = ..., lt: bool = ...
|
||||
) -> Literal[1, 0]: ...
|
||||
async def psetex(self, name, time_ms, value): ...
|
||||
async def pttl(self, name: _Key) -> int: ...
|
||||
async def hrandfield(self, key, count: Any | None = ..., withvalues: bool = ...): ...
|
||||
async def randomkey(self, **kwargs: _CommandOptions): ...
|
||||
async def rename(self, src, dst): ...
|
||||
async def renamenx(self, src, dst): ...
|
||||
async def restore(
|
||||
self, name, ttl, value, replace: bool = ..., absttl: bool = ..., idletime: Any | None = ..., frequency: Any | None = ...
|
||||
): ...
|
||||
async def set(
|
||||
self,
|
||||
name: _Key,
|
||||
value: _Value,
|
||||
ex: None | int | timedelta = ...,
|
||||
px: None | int | timedelta = ...,
|
||||
nx: bool = ...,
|
||||
xx: bool = ...,
|
||||
keepttl: bool = ...,
|
||||
get: bool = ...,
|
||||
exat: Any | None = ...,
|
||||
pxat: Any | None = ...,
|
||||
) -> bool | None: ...
|
||||
async def setbit(self, name: _Key, offset: int, value: int) -> int: ...
|
||||
async def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ...
|
||||
async def setnx(self, name: _Key, value: _Value) -> bool: ...
|
||||
async def setrange(self, name, offset, value): ...
|
||||
async def stralgo(
|
||||
self,
|
||||
algo,
|
||||
value1,
|
||||
value2,
|
||||
specific_argument: str = ...,
|
||||
len: bool = ...,
|
||||
idx: bool = ...,
|
||||
minmatchlen: Any | None = ...,
|
||||
withmatchlen: bool = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
): ...
|
||||
async def strlen(self, name): ...
|
||||
async def substr(self, name, start, end: int = ...): ...
|
||||
async def touch(self, *args): ...
|
||||
async def ttl(self, name: _Key) -> int: ...
|
||||
async def type(self, name): ...
|
||||
async def watch(self, *names): ...
|
||||
async def unwatch(self): ...
|
||||
async def unlink(self, *names: _Key) -> int: ...
|
||||
def __getitem__(self, name: str): ...
|
||||
def __setitem__(self, name, value) -> None: ...
|
||||
def __delitem__(self, name: _Key) -> None: ...
|
||||
def __contains__(self, name: _Key) -> None: ...
|
||||
|
||||
class ListCommands(Generic[_StrType]):
|
||||
@overload
|
||||
@@ -329,7 +545,73 @@ class ListCommands(Generic[_StrType]):
|
||||
groups: bool = ...,
|
||||
) -> int: ...
|
||||
|
||||
AsyncListCommands = ListCommands
|
||||
class AsyncListCommands(Generic[_StrType]):
|
||||
@overload
|
||||
async def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ...
|
||||
@overload
|
||||
async def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ...
|
||||
@overload
|
||||
async def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = ...) -> tuple[_StrType, _StrType]: ...
|
||||
@overload
|
||||
async def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ...
|
||||
async def brpoplpush(self, src, dst, timeout: int | None = ...): ...
|
||||
async def lindex(self, name: _Key, index: int) -> _StrType | None: ...
|
||||
async def linsert(
|
||||
self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value
|
||||
) -> int: ...
|
||||
async def llen(self, name: _Key) -> int: ...
|
||||
async def lpop(self, name, count: int | None = ...): ...
|
||||
async def lpush(self, name: _Value, *values: _Value) -> int: ...
|
||||
async def lpushx(self, name, value): ...
|
||||
async def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ...
|
||||
async def lrem(self, name: _Key, count: int, value: _Value) -> int: ...
|
||||
async def lset(self, name: _Key, index: int, value: _Value) -> bool: ...
|
||||
async def ltrim(self, name: _Key, start: int, end: int) -> bool: ...
|
||||
async def rpop(self, name, count: int | None = ...): ...
|
||||
async def rpoplpush(self, src, dst): ...
|
||||
async def rpush(self, name: _Value, *values: _Value) -> int: ...
|
||||
async def rpushx(self, name, value): ...
|
||||
async def lpos(self, name, value, rank: Any | None = ..., count: Any | None = ..., maxlen: Any | None = ...): ...
|
||||
@overload
|
||||
async def sort(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
by: _Key | None = ...,
|
||||
get: _Key | Sequence[_Key] | None = ...,
|
||||
desc: bool = ...,
|
||||
alpha: bool = ...,
|
||||
store: None = ...,
|
||||
groups: bool = ...,
|
||||
) -> list[_StrType]: ...
|
||||
@overload
|
||||
async def sort(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
by: _Key | None = ...,
|
||||
get: _Key | Sequence[_Key] | None = ...,
|
||||
desc: bool = ...,
|
||||
alpha: bool = ...,
|
||||
*,
|
||||
store: _Key,
|
||||
groups: bool = ...,
|
||||
) -> int: ...
|
||||
@overload
|
||||
async def sort(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int | None,
|
||||
num: int | None,
|
||||
by: _Key | None,
|
||||
get: _Key | Sequence[_Key] | None,
|
||||
desc: bool,
|
||||
alpha: bool,
|
||||
store: _Key,
|
||||
groups: bool = ...,
|
||||
) -> int: ...
|
||||
|
||||
class ScanCommands(Generic[_StrType]):
|
||||
def scan(
|
||||
@@ -369,6 +651,44 @@ class ScanCommands(Generic[_StrType]):
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
|
||||
class AsyncScanCommands(Generic[_StrType]):
|
||||
async def scan(
|
||||
self,
|
||||
cursor: int = ...,
|
||||
match: _Key | None = ...,
|
||||
count: int | None = ...,
|
||||
_type: str | None = ...,
|
||||
**kwargs: _CommandOptions,
|
||||
) -> tuple[int, list[_StrType]]: ...
|
||||
def scan_iter(
|
||||
self, match: _Key | None = ..., count: int | None = ..., _type: str | None = ..., **kwargs: _CommandOptions
|
||||
) -> AsyncIterator[_StrType]: ...
|
||||
async def sscan(
|
||||
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
|
||||
) -> tuple[int, list[_StrType]]: ...
|
||||
def sscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> AsyncIterator[_StrType]: ...
|
||||
async def hscan(
|
||||
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
|
||||
) -> tuple[int, dict[_StrType, _StrType]]: ...
|
||||
def hscan_iter(
|
||||
self, name: _Key, match: _Key | None = ..., count: int | None = ...
|
||||
) -> AsyncIterator[tuple[_StrType, _StrType]]: ...
|
||||
async def zscan(
|
||||
self,
|
||||
name: _Key,
|
||||
cursor: int = ...,
|
||||
match: _Key | None = ...,
|
||||
count: int | None = ...,
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
|
||||
def zscan_iter(
|
||||
self,
|
||||
name: _Key,
|
||||
match: _Key | None = ...,
|
||||
count: int | None = ...,
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
|
||||
class SetCommands(Generic[_StrType]):
|
||||
def sadd(self, name: _Key, *values: _Value) -> int: ...
|
||||
def scard(self, name: _Key) -> int: ...
|
||||
@@ -392,25 +712,28 @@ class SetCommands(Generic[_StrType]):
|
||||
def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
|
||||
def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
|
||||
|
||||
class AsyncScanCommands(ScanCommands[_StrType], Generic[_StrType]):
|
||||
async def scan_iter( # type: ignore[override]
|
||||
self, match: PatternT | None = ..., count: int | None = ..., _type: str | None = ..., **kwargs
|
||||
) -> AsyncIterator[Any]: ...
|
||||
async def sscan_iter( # type: ignore[override]
|
||||
self, name: KeyT, match: PatternT | None = ..., count: int | None = ...
|
||||
) -> AsyncIterator[Any]: ...
|
||||
async def hscan_iter( # type: ignore[override]
|
||||
self, name: str, match: PatternT | None = ..., count: int | None = ...
|
||||
) -> AsyncIterator[Any]: ...
|
||||
async def zscan_iter( # type: ignore[override]
|
||||
self,
|
||||
name: KeyT,
|
||||
match: PatternT | None = ...,
|
||||
count: int | None = ...,
|
||||
score_cast_func: type[Any] | Callable[..., Any] = ...,
|
||||
) -> AsyncIterator[Any]: ...
|
||||
|
||||
AsyncSetCommands = SetCommands
|
||||
class AsyncSetCommands(Generic[_StrType]):
|
||||
async def sadd(self, name: _Key, *values: _Value) -> int: ...
|
||||
async def scard(self, name: _Key) -> int: ...
|
||||
async def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
|
||||
async def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
|
||||
async def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
|
||||
async def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
|
||||
async def sismember(self, name: _Key, value: _Value) -> bool: ...
|
||||
async def smembers(self, name: _Key) -> builtins.set[_StrType]: ...
|
||||
async def smismember(self, name, values, *args): ...
|
||||
async def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ...
|
||||
@overload
|
||||
async def spop(self, name: _Key, count: None = ...) -> _Value | None: ...
|
||||
@overload
|
||||
async def spop(self, name: _Key, count: int) -> list[_Value]: ...
|
||||
@overload
|
||||
async def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ...
|
||||
@overload
|
||||
async def srandmember(self, name: _Key, number: int) -> list[_Value]: ...
|
||||
async def srem(self, name: _Key, *values: _Value) -> int: ...
|
||||
async def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
|
||||
async def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
|
||||
|
||||
class StreamCommands:
|
||||
def xack(self, name, groupname, *ids): ...
|
||||
@@ -453,7 +776,46 @@ class StreamCommands:
|
||||
def xrevrange(self, name, max: str = ..., min: str = ..., count: Any | None = ...): ...
|
||||
def xtrim(self, name, maxlen: int, approximate: bool = ..., minid: Any | None = ..., limit: Any | None = ...): ...
|
||||
|
||||
AsyncStreamCommands = StreamCommands
|
||||
class AsyncStreamCommands:
|
||||
async def xack(self, name, groupname, *ids): ...
|
||||
async def xadd(
|
||||
self,
|
||||
name,
|
||||
fields,
|
||||
id: str = ...,
|
||||
maxlen=...,
|
||||
approximate: bool = ...,
|
||||
nomkstream: bool = ...,
|
||||
minid: Any | None = ...,
|
||||
limit: Any | None = ...,
|
||||
): ...
|
||||
async def xautoclaim(
|
||||
self, name, groupname, consumername, min_idle_time, start_id: int = ..., count: Any | None = ..., justid: bool = ...
|
||||
): ...
|
||||
async def xclaim(
|
||||
self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=...
|
||||
): ...
|
||||
async def xdel(self, name, *ids): ...
|
||||
async def xgroup_create(self, name, groupname, id: str = ..., mkstream: bool = ...): ...
|
||||
async def xgroup_delconsumer(self, name, groupname, consumername): ...
|
||||
async def xgroup_destroy(self, name, groupname): ...
|
||||
async def xgroup_createconsumer(self, name, groupname, consumername): ...
|
||||
async def xgroup_setid(self, name, groupname, id): ...
|
||||
async def xinfo_consumers(self, name, groupname): ...
|
||||
async def xinfo_groups(self, name): ...
|
||||
async def xinfo_stream(self, name, full: bool = ...): ...
|
||||
async def xlen(self, name: _Key) -> int: ...
|
||||
async def xpending(self, name, groupname): ...
|
||||
async def xpending_range(
|
||||
self, name: _Key, groupname, min, max, count: int, consumername: Any | None = ..., idle: int | None = ...
|
||||
): ...
|
||||
async def xrange(self, name, min: str = ..., max: str = ..., count: Any | None = ...): ...
|
||||
async def xread(self, streams, count: Any | None = ..., block: Any | None = ...): ...
|
||||
async def xreadgroup(
|
||||
self, groupname, consumername, streams, count: Any | None = ..., block: Any | None = ..., noack: bool = ...
|
||||
): ...
|
||||
async def xrevrange(self, name, max: str = ..., min: str = ..., count: Any | None = ...): ...
|
||||
async def xtrim(self, name, maxlen: int, approximate: bool = ..., minid: Any | None = ..., limit: Any | None = ...): ...
|
||||
|
||||
class SortedSetCommands(Generic[_StrType]):
|
||||
def zadd(
|
||||
@@ -617,14 +979,181 @@ class SortedSetCommands(Generic[_StrType]):
|
||||
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...) -> int: ...
|
||||
def zmscore(self, key, members): ...
|
||||
|
||||
AsyncSortedSetCommands = SortedSetCommands
|
||||
class AsyncSortedSetCommands(Generic[_StrType]):
|
||||
async def zadd(
|
||||
self,
|
||||
name: _Key,
|
||||
mapping: Mapping[_Key, _Value],
|
||||
nx: bool = ...,
|
||||
xx: bool = ...,
|
||||
ch: bool = ...,
|
||||
incr: bool = ...,
|
||||
gt: Any | None = ...,
|
||||
lt: Any | None = ...,
|
||||
) -> int: ...
|
||||
async def zcard(self, name: _Key) -> int: ...
|
||||
async def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zdiff(self, keys, withscores: bool = ...): ...
|
||||
async def zdiffstore(self, dest, keys): ...
|
||||
async def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ...
|
||||
async def zinter(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ...
|
||||
async def zinterstore(
|
||||
self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...
|
||||
) -> int: ...
|
||||
async def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zpopmax(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ...
|
||||
async def zpopmin(self, name: _Key, count: int | None = ...) -> list[tuple[_StrType, float]]: ...
|
||||
async def zrandmember(self, key, count: Any | None = ..., withscores: bool = ...): ...
|
||||
@overload
|
||||
async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ...
|
||||
@overload
|
||||
async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ...
|
||||
@overload
|
||||
async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> tuple[_StrType, _StrType, float]: ...
|
||||
@overload
|
||||
async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ...
|
||||
@overload
|
||||
async def zrange(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int,
|
||||
end: int,
|
||||
desc: bool,
|
||||
withscores: Literal[True],
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
byscore: bool = ...,
|
||||
bylex: bool = ...,
|
||||
offset: int | None = ...,
|
||||
num: int | None = ...,
|
||||
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
@overload
|
||||
async def zrange(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int,
|
||||
end: int,
|
||||
desc: bool = ...,
|
||||
*,
|
||||
withscores: Literal[True],
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
byscore: bool = ...,
|
||||
bylex: bool = ...,
|
||||
offset: int | None = ...,
|
||||
num: int | None = ...,
|
||||
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
@overload
|
||||
async def zrange(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int,
|
||||
end: int,
|
||||
desc: bool = ...,
|
||||
withscores: bool = ...,
|
||||
score_cast_func: Callable[[_StrType], Any] = ...,
|
||||
byscore: bool = ...,
|
||||
bylex: bool = ...,
|
||||
offset: int | None = ...,
|
||||
num: int | None = ...,
|
||||
) -> list[_StrType]: ...
|
||||
@overload
|
||||
async def zrevrange(
|
||||
self,
|
||||
name: _Key,
|
||||
start: int,
|
||||
end: int,
|
||||
withscores: Literal[True],
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
@overload
|
||||
async def zrevrange(
|
||||
self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ...
|
||||
) -> list[_StrType]: ...
|
||||
async def zrangestore(
|
||||
self,
|
||||
dest,
|
||||
name,
|
||||
start,
|
||||
end,
|
||||
byscore: bool = ...,
|
||||
bylex: bool = ...,
|
||||
desc: bool = ...,
|
||||
offset: Any | None = ...,
|
||||
num: Any | None = ...,
|
||||
): ...
|
||||
async def zrangebylex(
|
||||
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...
|
||||
) -> list[_StrType]: ...
|
||||
async def zrevrangebylex(
|
||||
self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ...
|
||||
) -> list[_StrType]: ...
|
||||
@overload
|
||||
async def zrangebyscore(
|
||||
self,
|
||||
name: _Key,
|
||||
min: _Value,
|
||||
max: _Value,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
*,
|
||||
withscores: Literal[True],
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
@overload
|
||||
async def zrangebyscore(
|
||||
self,
|
||||
name: _Key,
|
||||
min: _Value,
|
||||
max: _Value,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
withscores: bool = ...,
|
||||
score_cast_func: Callable[[_StrType], Any] = ...,
|
||||
) -> list[_StrType]: ...
|
||||
@overload
|
||||
async def zrevrangebyscore(
|
||||
self,
|
||||
name: _Key,
|
||||
max: _Value,
|
||||
min: _Value,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
*,
|
||||
withscores: Literal[True],
|
||||
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
|
||||
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
|
||||
@overload
|
||||
async def zrevrangebyscore(
|
||||
self,
|
||||
name: _Key,
|
||||
max: _Value,
|
||||
min: _Value,
|
||||
start: int | None = ...,
|
||||
num: int | None = ...,
|
||||
withscores: bool = ...,
|
||||
score_cast_func: Callable[[_StrType], Any] = ...,
|
||||
) -> list[_StrType]: ...
|
||||
async def zrank(self, name: _Key, value: _Value) -> int | None: ...
|
||||
async def zrem(self, name: _Key, *values: _Value) -> int: ...
|
||||
async def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ...
|
||||
async def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ...
|
||||
async def zrevrank(self, name: _Key, value: _Value) -> int | None: ...
|
||||
async def zscore(self, name: _Key, value: _Value) -> float | None: ...
|
||||
async def zunion(self, keys, aggregate: Any | None = ..., withscores: bool = ...): ...
|
||||
async def zunionstore(
|
||||
self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = ...
|
||||
) -> int: ...
|
||||
async def zmscore(self, key, members): ...
|
||||
|
||||
class HyperlogCommands:
|
||||
def pfadd(self, name: _Key, *values: _Value) -> int: ...
|
||||
def pfcount(self, name: _Key) -> int: ...
|
||||
def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ...
|
||||
|
||||
AsyncHyperlogCommands = HyperlogCommands
|
||||
class AsyncHyperlogCommands:
|
||||
async def pfadd(self, name: _Key, *values: _Value) -> int: ...
|
||||
async def pfcount(self, name: _Key) -> int: ...
|
||||
async def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ...
|
||||
|
||||
class HashCommands(Generic[_StrType]):
|
||||
def hdel(self, name: _Key, *keys: _Key) -> int: ...
|
||||
@@ -649,7 +1178,28 @@ class HashCommands(Generic[_StrType]):
|
||||
def hvals(self, name: _Key) -> list[_StrType]: ...
|
||||
def hstrlen(self, name, key): ...
|
||||
|
||||
AsyncHashCommands = HashCommands
|
||||
class AsyncHashCommands(Generic[_StrType]):
|
||||
async def hdel(self, name: _Key, *keys: _Key) -> int: ...
|
||||
async def hexists(self, name: _Key, key: _Key) -> bool: ...
|
||||
async def hget(self, name: _Key, key: _Key) -> _StrType | None: ...
|
||||
async def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ...
|
||||
async def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ...
|
||||
async def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ...
|
||||
async def hkeys(self, name: _Key) -> list[_StrType]: ...
|
||||
async def hlen(self, name: _Key) -> int: ...
|
||||
@overload
|
||||
async def hset(
|
||||
self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ..., items: Any | None = ...
|
||||
) -> int: ...
|
||||
@overload
|
||||
async def hset(self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ...
|
||||
@overload
|
||||
async def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Any | None = ...) -> int: ...
|
||||
async def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ...
|
||||
async def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ...
|
||||
async def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ...
|
||||
async def hvals(self, name: _Key) -> list[_StrType]: ...
|
||||
async def hstrlen(self, name, key): ...
|
||||
|
||||
class AsyncScript:
|
||||
def __init__(self, registered_client: AsyncRedis[Any], script: ScriptTextT) -> None: ...
|
||||
@@ -663,7 +1213,11 @@ class PubSubCommands:
|
||||
def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ...
|
||||
def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ...
|
||||
|
||||
AsyncPubSubCommands = PubSubCommands
|
||||
class AsyncPubSubCommands:
|
||||
async def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> int: ...
|
||||
async def pubsub_channels(self, pattern: _Key = ..., **kwargs: _CommandOptions) -> list[str]: ...
|
||||
async def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ...
|
||||
async def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ...
|
||||
|
||||
class ScriptCommands(Generic[_StrType]):
|
||||
def eval(self, script, numkeys, *keys_and_args): ...
|
||||
@@ -675,8 +1229,14 @@ class ScriptCommands(Generic[_StrType]):
|
||||
def script_load(self, script): ...
|
||||
def register_script(self, script: str | _StrType) -> Script: ...
|
||||
|
||||
class AsyncScriptCommands(ScriptCommands[_StrType], Generic[_StrType]):
|
||||
async def script_debug(self, *args) -> None: ...
|
||||
class AsyncScriptCommands(Generic[_StrType]):
|
||||
async def eval(self, script, numkeys, *keys_and_args): ...
|
||||
async def evalsha(self, sha, numkeys, *keys_and_args): ...
|
||||
async def script_exists(self, *args): ...
|
||||
async def script_debug(self, *args): ...
|
||||
async def script_flush(self, sync_type: Any | None = ...): ...
|
||||
async def script_kill(self): ...
|
||||
async def script_load(self, script): ...
|
||||
def register_script(self, script: ScriptTextT) -> AsyncScript: ... # type: ignore[override]
|
||||
|
||||
class GeoCommands:
|
||||
@@ -749,7 +1309,75 @@ class GeoCommands:
|
||||
storedist: bool = ...,
|
||||
): ...
|
||||
|
||||
AsyncGeoCommands = GeoCommands
|
||||
class AsyncGeoCommands:
|
||||
async def geoadd(self, name, values, nx: bool = ..., xx: bool = ..., ch: bool = ...): ...
|
||||
async def geodist(self, name, place1, place2, unit: Any | None = ...): ...
|
||||
async def geohash(self, name, *values): ...
|
||||
async def geopos(self, name, *values): ...
|
||||
async def georadius(
|
||||
self,
|
||||
name,
|
||||
longitude,
|
||||
latitude,
|
||||
radius,
|
||||
unit: Any | None = ...,
|
||||
withdist: bool = ...,
|
||||
withcoord: bool = ...,
|
||||
withhash: bool = ...,
|
||||
count: Any | None = ...,
|
||||
sort: Any | None = ...,
|
||||
store: Any | None = ...,
|
||||
store_dist: Any | None = ...,
|
||||
any: bool = ...,
|
||||
): ...
|
||||
async def georadiusbymember(
|
||||
self,
|
||||
name,
|
||||
member,
|
||||
radius,
|
||||
unit: Any | None = ...,
|
||||
withdist: bool = ...,
|
||||
withcoord: bool = ...,
|
||||
withhash: bool = ...,
|
||||
count: Any | None = ...,
|
||||
sort: Any | None = ...,
|
||||
store: Any | None = ...,
|
||||
store_dist: Any | None = ...,
|
||||
any: bool = ...,
|
||||
): ...
|
||||
async def geosearch(
|
||||
self,
|
||||
name,
|
||||
member: Any | None = ...,
|
||||
longitude: Any | None = ...,
|
||||
latitude: Any | None = ...,
|
||||
unit: str = ...,
|
||||
radius: Any | None = ...,
|
||||
width: Any | None = ...,
|
||||
height: Any | None = ...,
|
||||
sort: Any | None = ...,
|
||||
count: Any | None = ...,
|
||||
any: bool = ...,
|
||||
withcoord: bool = ...,
|
||||
withdist: bool = ...,
|
||||
withhash: bool = ...,
|
||||
): ...
|
||||
async def geosearchstore(
|
||||
self,
|
||||
dest,
|
||||
name,
|
||||
member: Any | None = ...,
|
||||
longitude: Any | None = ...,
|
||||
latitude: Any | None = ...,
|
||||
unit: str = ...,
|
||||
radius: Any | None = ...,
|
||||
width: Any | None = ...,
|
||||
height: Any | None = ...,
|
||||
sort: Any | None = ...,
|
||||
count: Any | None = ...,
|
||||
any: bool = ...,
|
||||
storedist: bool = ...,
|
||||
): ...
|
||||
|
||||
class ModuleCommands:
|
||||
def module_load(self, path, *args): ...
|
||||
@@ -783,7 +1411,10 @@ class ClusterCommands:
|
||||
def readwrite(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
def readonly(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
|
||||
AsyncClusterCommands = ClusterCommands
|
||||
class AsyncClusterCommands:
|
||||
async def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions): ...
|
||||
async def readwrite(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
async def readonly(self, **kwargs: _CommandOptions) -> bool: ...
|
||||
|
||||
class FunctionCommands:
|
||||
def function_load(
|
||||
@@ -799,7 +1430,19 @@ class FunctionCommands:
|
||||
def function_kill(self) -> Awaitable[str] | str: ...
|
||||
def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ...
|
||||
|
||||
AsyncFunctionCommands = FunctionCommands
|
||||
class AsyncFunctionCommands:
|
||||
async def function_load(
|
||||
self, engine: str, library: str, code: str, replace: bool | None = ..., description: str | None = ...
|
||||
) -> Awaitable[str] | str: ...
|
||||
async def function_delete(self, library: str) -> Awaitable[str] | str: ...
|
||||
async def function_flush(self, mode: str = ...) -> Awaitable[str] | str: ...
|
||||
async def function_list(self, library: str | None = ..., withcode: bool | None = ...) -> Awaitable[list[Any]] | list[Any]: ...
|
||||
async def fcall(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ...
|
||||
async def fcall_ro(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ...
|
||||
async def function_dump(self) -> Awaitable[str] | str: ...
|
||||
async def function_restore(self, payload: str, policy: str | None = ...) -> Awaitable[str] | str: ...
|
||||
async def function_kill(self) -> Awaitable[str] | str: ...
|
||||
async def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ...
|
||||
|
||||
class DataAccessCommands(
|
||||
BasicKeyCommands[_StrType],
|
||||
|
||||
Reference in New Issue
Block a user