Big diff: use lower-case list and dict (#5888)

This commit is contained in:
Akuli
2021-08-08 19:26:35 +03:00
committed by GitHub
parent 11f54c3407
commit ce11072dbe
325 changed files with 2196 additions and 2334 deletions

View File

@@ -1,22 +1,5 @@
from datetime import datetime, timedelta
from typing import (
Any,
Callable,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Sequence,
Set,
Text,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, Sequence, Set, Text, Tuple, Type, TypeVar, Union, overload
from typing_extensions import Literal
from .connection import ConnectionPool
@@ -392,11 +375,11 @@ class Redis(Generic[_StrType]):
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): ...
def acl_cat(self, category: Text | None = ...) -> List[str]: ...
def acl_cat(self, category: Text | None = ...) -> list[str]: ...
def acl_deluser(self, username: Text) -> int: ...
def acl_genpass(self) -> Text: ...
def acl_getuser(self, username: Text) -> Any | None: ...
def acl_list(self) -> List[Text]: ...
def acl_list(self) -> list[Text]: ...
def acl_load(self) -> bool: ...
def acl_setuser(
self,
@@ -412,13 +395,13 @@ class Redis(Generic[_StrType]):
reset_keys: bool = ...,
reset_passwords: bool = ...,
) -> bool: ...
def acl_users(self) -> List[Text]: ...
def acl_users(self) -> list[Text]: ...
def acl_whoami(self) -> Text: ...
def bgrewriteaof(self): ...
def bgsave(self): ...
def client_id(self) -> int: ...
def client_kill(self, address: Text) -> bool: ...
def client_list(self) -> List[Dict[str, str]]: ...
def client_list(self) -> list[dict[str, str]]: ...
def client_getname(self) -> str | None: ...
def client_setname(self, name: Text) -> bool: ...
def readwrite(self) -> bool: ...
@@ -472,8 +455,8 @@ class Redis(Generic[_StrType]):
def incr(self, name: _Key, amount: int = ...) -> int: ...
def incrby(self, name: _Key, amount: int = ...) -> int: ...
def incrbyfloat(self, name: _Key, amount: float = ...) -> float: ...
def keys(self, pattern: _Key = ...) -> List[_StrType]: ...
def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> List[_StrType | None]: ...
def keys(self, pattern: _Key = ...) -> list[_StrType]: ...
def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ...
def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ...
def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ...
def move(self, name: _Key, db: int) -> bool: ...
@@ -525,7 +508,7 @@ class Redis(Generic[_StrType]):
def lpop(self, name): ...
def lpush(self, name: _Value, *values: _Value) -> int: ...
def lpushx(self, name, value): ...
def lrange(self, name: _Key, start: int, end: int) -> List[_StrType]: ...
def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ...
def lrem(self, name: _Key, count: int, value: _Value) -> int: ...
def lset(self, name: _Key, index: int, value: _Value) -> bool: ...
def ltrim(self, name: _Key, start: int, end: int) -> bool: ...
@@ -545,7 +528,7 @@ class Redis(Generic[_StrType]):
alpha: bool = ...,
store: None = ...,
groups: bool = ...,
) -> List[_StrType]: ...
) -> list[_StrType]: ...
@overload
def sort(
self,
@@ -573,13 +556,13 @@ class Redis(Generic[_StrType]):
store: _Key,
groups: bool = ...,
) -> int: ...
def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Tuple[int, List[_StrType]]: ...
def scan(self, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Tuple[int, list[_StrType]]: ...
def scan_iter(self, match: Text | None = ..., count: int | None = ...) -> Iterator[_StrType]: ...
def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Tuple[int, List[_StrType]]: ...
def sscan(self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...) -> Tuple[int, list[_StrType]]: ...
def sscan_iter(self, name, match=..., count=...): ...
def hscan(
self, name: _Key, cursor: int = ..., match: Text = ..., count: int = ...
) -> Tuple[int, Dict[_StrType, _StrType]]: ...
) -> Tuple[int, dict[_StrType, _StrType]]: ...
def hscan_iter(self, name, match=..., count=...): ...
def zscan(self, name, cursor=..., match=..., count=..., score_cast_func=...): ...
def zscan_iter(self, name, match=..., count=..., score_cast_func=...): ...
@@ -595,11 +578,11 @@ class Redis(Generic[_StrType]):
@overload
def spop(self, name: _Key, count: None = ...) -> _Value | None: ...
@overload
def spop(self, name: _Key, count: int) -> List[_Value]: ...
def spop(self, name: _Key, count: int) -> list[_Value]: ...
@overload
def srandmember(self, name: _Key, number: None = ...) -> _Value | None: ...
@overload
def srandmember(self, name: _Key, number: int) -> List[_Value]: ...
def srandmember(self, name: _Key, number: int) -> list[_Value]: ...
def srem(self, name: _Key, *values: _Value) -> int: ...
def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Set[_Value]: ...
def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
@@ -632,8 +615,8 @@ class Redis(Generic[_StrType]):
def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ...
def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ...
def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ...
def zpopmax(self, name: _Key, count: int | None = ...) -> List[_StrType]: ...
def zpopmin(self, name: _Key, count: int | None = ...) -> List[_StrType]: ...
def zpopmax(self, name: _Key, count: int | None = ...) -> list[_StrType]: ...
def zpopmin(self, name: _Key, count: int | None = ...) -> list[_StrType]: ...
@overload
def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = ...) -> Tuple[_StrType, _StrType, float]: ...
@overload
@@ -652,7 +635,7 @@ class Redis(Generic[_StrType]):
*,
withscores: Literal[True],
score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ...,
) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zrange(
self,
@@ -662,10 +645,10 @@ class Redis(Generic[_StrType]):
desc: bool = ...,
withscores: bool = ...,
score_cast_func: Callable[[Any], Any] = ...,
) -> List[_StrType]: ...
) -> list[_StrType]: ...
def zrangebylex(
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...
) -> List[_StrType]: ...
) -> list[_StrType]: ...
@overload
def zrangebyscore(
self,
@@ -677,7 +660,7 @@ class Redis(Generic[_StrType]):
*,
withscores: Literal[True],
score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ...,
) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zrangebyscore(
self,
@@ -688,7 +671,7 @@ class Redis(Generic[_StrType]):
num: int | None = ...,
withscores: bool = ...,
score_cast_func: Callable[[Any], Any] = ...,
) -> List[_StrType]: ...
) -> list[_StrType]: ...
def zrank(self, name: _Key, value: _Value) -> int | None: ...
def zrem(self, name: _Key, *values: _Value) -> int: ...
def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ...
@@ -704,7 +687,7 @@ class Redis(Generic[_StrType]):
*,
withscores: Literal[True],
score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ...,
) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zrevrange(
self,
@@ -714,7 +697,7 @@ class Redis(Generic[_StrType]):
desc: bool = ...,
withscores: bool = ...,
score_cast_func: Callable[[Any], Any] = ...,
) -> List[_StrType]: ...
) -> list[_StrType]: ...
@overload
def zrevrangebyscore(
self,
@@ -726,7 +709,7 @@ class Redis(Generic[_StrType]):
*,
withscores: Literal[True],
score_cast_func: Callable[[float], _ScoreCastFuncReturn] = ...,
) -> List[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
) -> list[Tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zrevrangebyscore(
self,
@@ -737,10 +720,10 @@ class Redis(Generic[_StrType]):
num: int | None = ...,
withscores: bool = ...,
score_cast_func: Callable[[Any], Any] = ...,
) -> List[_StrType]: ...
) -> list[_StrType]: ...
def zrevrangebylex(
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ...
) -> List[_StrType]: ...
) -> list[_StrType]: ...
def zrevrank(self, name: _Key, value: _Value) -> int | None: ...
def zscore(self, name: _Key, value: _Value) -> float | None: ...
def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] = ...) -> int: ...
@@ -750,10 +733,10 @@ class Redis(Generic[_StrType]):
def hdel(self, name: _Key, *keys: _Key) -> int: ...
def hexists(self, name: _Key, key: _Key) -> bool: ...
def hget(self, name: _Key, key: _Key) -> _StrType | None: ...
def hgetall(self, name: _Key) -> Dict[_StrType, _StrType]: ...
def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ...
def hincrby(self, name: _Key, key: _Key, amount: int = ...) -> int: ...
def hincrbyfloat(self, name: _Key, key: _Key, amount: float = ...) -> float: ...
def hkeys(self, name: _Key) -> List[_StrType]: ...
def hkeys(self, name: _Key) -> list[_StrType]: ...
def hlen(self, name: _Key) -> int: ...
@overload
def hset(self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = ...) -> int: ...
@@ -763,8 +746,8 @@ class Redis(Generic[_StrType]):
def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value]) -> int: ...
def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ...
def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ...
def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> List[_StrType | None]: ...
def hvals(self, name: _Key) -> List[_StrType]: ...
def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ...
def hvals(self, name: _Key) -> list[_StrType]: ...
def publish(self, channel: _Key, message: _Key) -> int: ...
def eval(self, script, numkeys, *keys_and_args): ...
def evalsha(self, sha, numkeys, *keys_and_args): ...
@@ -773,8 +756,8 @@ class Redis(Generic[_StrType]):
def script_kill(self): ...
def script_load(self, script): ...
def register_script(self, script: Text | _StrType) -> Script: ...
def pubsub_channels(self, pattern: _Key = ...) -> List[Text]: ...
def pubsub_numsub(self, *args: _Key) -> List[Tuple[Text, int]]: ...
def pubsub_channels(self, pattern: _Key = ...) -> list[Text]: ...
def pubsub_numsub(self, *args: _Key) -> list[Tuple[Text, int]]: ...
def pubsub_numpat(self) -> int: ...
def monitor(self) -> Monitor: ...
def cluster(self, cluster_arg: str, *args: Any) -> Any: ...
@@ -813,8 +796,8 @@ class PubSub:
def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ...
def unsubscribe(self, *args: _Key) -> None: ...
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 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 ping(self, message: _Value | None = ...) -> None: ...
@@ -845,7 +828,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
def annotate_exception(self, exception, number, command): ...
def parse_response(self, connection, command_name, **options): ...
def load_scripts(self): ...
def execute(self, raise_on_error: bool = ...) -> List[Any]: ...
def execute(self, raise_on_error: bool = ...) -> list[Any]: ...
def watch(self, *names: _Key) -> bool: ...
def unwatch(self) -> bool: ...
# in the Redis implementation, the following methods are inherited from client.
@@ -1150,5 +1133,5 @@ class Monitor(object):
def __init__(self, connection_pool) -> None: ...
def __enter__(self) -> Monitor: ...
def __exit__(self, *args: Any) -> None: ...
def next_command(self) -> Dict[Text, Any]: ...
def listen(self) -> Iterable[Dict[Text, Any]]: ...
def next_command(self) -> dict[Text, Any]: ...
def listen(self) -> Iterable[dict[Text, Any]]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Mapping, Text, Tuple, Type
from typing import Any, Mapping, Text, Tuple, Type
ssl_available: Any
hiredis_version: Any
@@ -105,7 +105,7 @@ class Connection:
def read_response(self): ...
def pack_command(self, *args): ...
def pack_commands(self, commands): ...
def repr_pieces(self) -> List[Tuple[Text, Text]]: ...
def repr_pieces(self) -> list[Tuple[Text, Text]]: ...
class SSLConnection(Connection):
description_format: Any
@@ -144,7 +144,7 @@ class UnixDomainSocketConnection(Connection):
health_check_interval: int = ...,
client_name=...,
) -> None: ...
def repr_pieces(self) -> List[Tuple[Text, Text]]: ...
def repr_pieces(self) -> list[Tuple[Text, Text]]: ...
def to_bool(value: object) -> bool: ...