diff --git a/third_party/2and3/redis/client.pyi b/third_party/2and3/redis/client.pyi index f086a4be5..c180df425 100644 --- a/third_party/2and3/redis/client.pyi +++ b/third_party/2and3/redis/client.pyi @@ -1,5 +1,5 @@ from datetime import timedelta -from typing import Any, Iterable, Text, Optional, Mapping, Tuple, Union +from typing import Any, Iterable, Text, Optional, Mapping, Tuple, Union, Callable, List from .connection import ConnectionPool @@ -34,12 +34,12 @@ def parse_hscan(response, **options): ... def parse_zscan(response, **options): ... def parse_slowlog_get(response, **options): ... -_Str = Union[bytes, float, Text] +_Str = Union[bytes, float, int, Text] class Redis(object): RESPONSE_CALLBACKS: Any @classmethod - def from_url(cls, url, db=..., **kwargs): ... + def from_url(cls, url: Text, db: Optional[int] = ..., **kwargs) -> Redis: ... connection_pool: Any response_callbacks: Any def __init__( @@ -71,7 +71,7 @@ class Redis(object): def pipeline(self, transaction=..., shard_hint=...): ... def transaction(self, func, *watches, **kwargs): ... def lock(self, name, timeout=..., sleep=..., blocking_timeout=..., lock_class=..., thread_local=...): ... - def pubsub(self, **kwargs): ... + 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 bgrewriteaof(self): ... @@ -84,12 +84,12 @@ class Redis(object): def config_set(self, name, value): ... def config_resetstat(self): ... def config_rewrite(self): ... - def dbsize(self): ... + def dbsize(self) -> int: ... def debug_object(self, key): ... def echo(self, value): ... def flushall(self): ... def flushdb(self): ... - def info(self, section=...): ... + def info(self, section: Optional[Text] = ...) -> Mapping[str, Any]: ... def lastsave(self): ... def object(self, infotype, key): ... def ping(self): ... @@ -146,7 +146,7 @@ class Redis(object): def set( self, name: Text, - value: Any, + value: _Str, ex: Union[None, int, timedelta] = ..., px: Union[None, int, timedelta] = ..., nx: bool = ..., @@ -181,8 +181,8 @@ class Redis(object): def rpush(self, name: _Str, *values: _Str) -> int: ... def rpushx(self, name, value): ... def sort(self, name, start=..., num=..., by=..., get=..., desc=..., alpha=..., store=..., groups=...): ... - def scan(self, cursor=..., match=..., count=...): ... - def scan_iter(self, match=..., count=...): ... + def scan(self, cursor: int = ..., match: Optional[Text] = ..., count: Optional[int] = ...) -> List[Text]: ... + def scan_iter(self, match: Optional[Text] = ..., count: Optional[int] = ...) -> List[Text]: ... def sscan(self, name, cursor=..., match=..., count=...): ... def sscan_iter(self, name, match=..., count=...): ... def hscan(self, name, cursor=..., match=..., count=...): ... @@ -269,7 +269,7 @@ class Redis(object): def hmset(self, name, mapping): ... def hmget(self, name, keys, *args): ... def hvals(self, name): ... - def publish(self, channel, message): ... + def publish(self, channel: Text, message: _Str) -> int: ... def eval(self, script, numkeys, *keys_and_args): ... def evalsha(self, sha, numkeys, *keys_and_args): ... def script_exists(self, *args): ... @@ -295,19 +295,19 @@ class PubSub: channels: Any patterns: Any def reset(self): ... - def close(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 psubscribe(self, *args, **kwargs): ... - def punsubscribe(self, *args): ... - def subscribe(self, *args, **kwargs): ... - def unsubscribe(self, *args): ... + def psubscribe(self, *args: Text, **kwargs: Callable[[Any], None]): ... + def punsubscribe(self, *args: Text) -> None: ... + def subscribe(self, *args: Text, **kwargs: Callable[[Any], None]) -> None: ... + def unsubscribe(self, *args: Text) -> None: ... def listen(self): ... - def get_message(self, ignore_subscribe_messages=...): ... + def get_message(self, ignore_subscribe_messages: bool = ..., timeout: int = ...) -> Optional[bytes]: ... def handle_message(self, response, ignore_subscribe_messages=...): ... def run_in_thread(self, sleep_time=...): ... diff --git a/third_party/2and3/redis/connection.pyi b/third_party/2and3/redis/connection.pyi index 7b7ddeff2..4086b6d96 100644 --- a/third_party/2and3/redis/connection.pyi +++ b/third_party/2and3/redis/connection.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Text, Optional ssl_available: Any hiredis_version: Any @@ -109,7 +109,7 @@ class UnixDomainSocketConnection(Connection): class ConnectionPool: @classmethod - def from_url(cls, url, db=..., **kwargs): ... + def from_url(cls, url: Text, db: Optional[int] = ..., **kwargs) -> ConnectionPool: ... connection_class: Any connection_kwargs: Any max_connections: Any