diff options
author | Utkarsh Gupta <utkarshgupta137@gmail.com> | 2022-05-30 19:04:06 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 16:34:06 +0300 |
commit | f704281cf4c1f735c06a13946fcea42fa939e3a5 (patch) | |
tree | 85a7affc680058b54d1df30d65e1f97c44c08847 /redis/asyncio/parser.py | |
parent | 48079083a7f6ac1bdd948c03175f9ffd42aa1f6b (diff) | |
download | redis-py-f704281cf4c1f735c06a13946fcea42fa939e3a5.tar.gz |
async_cluster: add/update typing (#2195)
* async_cluster: add/update typing
* async_cluster: update cleanup_kwargs with kwargs from async Connection
* async_cluster: properly remove old nodes
Diffstat (limited to 'redis/asyncio/parser.py')
-rw-r--r-- | redis/asyncio/parser.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/redis/asyncio/parser.py b/redis/asyncio/parser.py index 273fe03..6286351 100644 --- a/redis/asyncio/parser.py +++ b/redis/asyncio/parser.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union from redis.exceptions import RedisError, ResponseError @@ -25,7 +25,7 @@ class CommandsParser: __slots__ = ("commands",) def __init__(self) -> None: - self.commands = {} + self.commands: Dict[str, Union[int, Dict[str, Any]]] = {} async def initialize(self, r: "ClusterNode") -> None: commands = await r.execute_command("COMMAND") @@ -42,8 +42,8 @@ class CommandsParser: # our logic to use COMMAND INFO changes to determine the key positions # https://github.com/redis/redis/pull/8324 async def get_keys( - self, redis_conn: "ClusterNode", *args - ) -> Optional[Union[List[str], List[bytes]]]: + self, redis_conn: "ClusterNode", *args: Any + ) -> Optional[Tuple[str, ...]]: if len(args) < 2: # The command has no keys in it return None @@ -67,7 +67,7 @@ class CommandsParser: command = self.commands[cmd_name] if command == 1: - return [args[1]] + return (args[1],) if command == 0: return None if command == -1: @@ -79,8 +79,8 @@ class CommandsParser: return args[command["first_key_pos"] : last_key_pos + 1 : command["step_count"]] async def _get_moveable_keys( - self, redis_conn: "ClusterNode", *args - ) -> Optional[List[str]]: + self, redis_conn: "ClusterNode", *args: Any + ) -> Optional[Tuple[str, ...]]: try: keys = await redis_conn.execute_command("COMMAND GETKEYS", *args) except ResponseError as e: |