Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 43 additions & 16 deletions third_party/2and3/redis/client.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from typing import Any
from datetime import timedelta
from typing import Any, Text, Optional, Mapping, Union

from .connection import ConnectionPool

SYM_EMPTY: Any

Expand Down Expand Up @@ -31,16 +34,37 @@ def parse_hscan(response, **options): ...
def parse_zscan(response, **options): ...
def parse_slowlog_get(response, **options): ...

class StrictRedis:
class Redis(object):
RESPONSE_CALLBACKS: Any
@classmethod
def from_url(cls, url, db=..., **kwargs): ...
connection_pool: Any
response_callbacks: Any
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=...,
socket_keepalive=..., socket_keepalive_options=..., connection_pool=..., unix_socket_path=..., encoding=...,
encoding_errors=..., charset=..., errors=..., decode_responses=..., retry_on_timeout=..., ssl=...,
ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=...) -> None: ...
def __init__(
self,
host: Text = ...,
port: int = ...,
db: int = ...,
password: Optional[Text] = ...,
socket_timeout: Optional[float] = ...,
socket_connect_timeout: Optional[float] = ...,
socket_keepalive: Optional[bool] = ...,
socket_keepalive_options: Optional[Mapping[str, Union[int, str]]] = ...,
connection_pool: Optional[ConnectionPool] = ...,
unix_socket_path: Optional[Text] = ...,
encoding: Text = ...,
encoding_errors: Text = ...,
charset: Optional[Text] = ...,
errors: Optional[Text] = ...,
decode_responses: bool = ...,
retry_on_timeout: bool = ...,
ssl: bool = ...,
ssl_keyfile: Optional[Text] = ...,
ssl_certfile: Optional[Text] = ...,
ssl_cert_reqs: Optional[Union[str, int]] = ...,
ssl_ca_certs: Optional[Text] = ...,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max_connections: Optional[int] = ...,
) -> None: ...
def set_response_callback(self, command, callback): ...
def pipeline(self, transaction=..., shard_hint=...): ...
def transaction(self, func, *watches, **kwargs): ...
Expand Down Expand Up @@ -93,9 +117,9 @@ class StrictRedis:
def dump(self, name): ...
def exists(self, name): ...
__contains__: Any
def expire(self, name, time): ...
def expire(self, name: Text, time: Union[int, timedelta]) -> bool: ...
def expireat(self, name, when): ...
def get(self, name): ...
def get(self, name: Text) -> Optional[bytes]: ...
def __getitem__(self, name): ...
def getbit(self, name, offset): ...
def getrange(self, key, start, end): ...
Expand All @@ -117,7 +141,15 @@ class StrictRedis:
def rename(self, src, dst): ...
def renamenx(self, src, dst): ...
def restore(self, name, ttl, value): ...
def set(self, name, value, ex=..., px=..., nx=..., xx=...): ...
def set(
self,
name: Text,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think name (here and in the other methods too) can be either str or bytes.

value: Any,
ex: Union[None, int, timedelta] = ...,
px: Union[None, int, timedelta] = ...,
nx: bool = ...,
xx: bool = ...,
) -> Optional[bool]: ...
def __setitem__(self, name, value): ...
def setbit(self, name, offset, value): ...
def setex(self, name, time, value): ...
Expand Down Expand Up @@ -169,7 +201,7 @@ class StrictRedis:
def srem(self, name, *values): ...
def sunion(self, keys, *args): ...
def sunionstore(self, dest, keys, *args): ...
def zadd(self, name, *args, **kwargs): ...
def zadd(self, name, mapping, nx: bool = ..., xx: bool = ..., ch: bool = ..., incr: bool = ...): ...
def zcard(self, name): ...
def zcount(self, name, min, max): ...
def zincrby(self, name, value, amount=...): ...
Expand Down Expand Up @@ -213,12 +245,7 @@ class StrictRedis:
def script_load(self, script): ...
def register_script(self, script): ...

class Redis(StrictRedis):
RESPONSE_CALLBACKS: Any
def pipeline(self, transaction=..., shard_hint=...): ...
def setex(self, name, value, time): ...
def lrem(self, name, value, num=...): ...
def zadd(self, name, *args, **kwargs): ...
StrictRedis = Redis

class PubSub:
PUBLISH_MESSAGE_TYPES: Any
Expand Down