-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add a few Redis types #3016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add a few Redis types #3016
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
|
|
@@ -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] = ..., | ||
| max_connections: Optional[int] = ..., | ||
| ) -> None: ... | ||
| def set_response_callback(self, command, callback): ... | ||
| def pipeline(self, transaction=..., shard_hint=...): ... | ||
| def transaction(self, func, *watches, **kwargs): ... | ||
|
|
@@ -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): ... | ||
|
|
@@ -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, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
| 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): ... | ||
|
|
@@ -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=...): ... | ||
|
|
@@ -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 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the
max_connections=Noneargument (https://github.com/andymccurdy/redis-py/blob/master/redis/client.py#L635).