Skip to content

Commit c730213

Browse files
committed
Fixing several *arg type hints in core.py and json module commands
1 parent 3471e08 commit c730213

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

redis/commands/core.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ def command_list(
830830

831831
return self.execute_command("COMMAND LIST", *pieces)
832832

833-
def command_getkeysandflags(self, *args: List[str]) -> List[Union[str, List[str]]]:
833+
def command_getkeysandflags(self, *args: str) -> List[Union[str, List[str]]]:
834834
"""
835835
Returns array of keys from a full Redis command and their usage flags.
836836
@@ -848,7 +848,7 @@ def command_docs(self, *args):
848848
)
849849

850850
def config_get(
851-
self, pattern: PatternT = "*", *args: List[PatternT], **kwargs
851+
self, pattern: PatternT = "*", *args: PatternT, **kwargs
852852
) -> ResponseT:
853853
"""
854854
Return a dictionary of configuration based on the ``pattern``
@@ -861,7 +861,7 @@ def config_set(
861861
self,
862862
name: KeyT,
863863
value: EncodableT,
864-
*args: List[Union[KeyT, EncodableT]],
864+
*args: Union[KeyT, EncodableT],
865865
**kwargs,
866866
) -> ResponseT:
867867
"""Set config item ``name`` with ``value``
@@ -987,9 +987,7 @@ def select(self, index: int, **kwargs) -> ResponseT:
987987
"""
988988
return self.execute_command("SELECT", index, **kwargs)
989989

990-
def info(
991-
self, section: Optional[str] = None, *args: List[str], **kwargs
992-
) -> ResponseT:
990+
def info(self, section: Optional[str] = None, *args: str, **kwargs) -> ResponseT:
993991
"""
994992
Returns a dictionary containing information about the Redis server
995993
@@ -2606,7 +2604,7 @@ def blmpop(
26062604
self,
26072605
timeout: float,
26082606
numkeys: int,
2609-
*args: List[str],
2607+
*args: str,
26102608
direction: str,
26112609
count: Optional[int] = 1,
26122610
) -> Optional[list]:
@@ -2619,14 +2617,14 @@ def blmpop(
26192617
26202618
For more information, see https://redis.io/commands/blmpop
26212619
"""
2622-
args = [timeout, numkeys, *args, direction, "COUNT", count]
2620+
cmd_args = [timeout, numkeys, *args, direction, "COUNT", count]
26232621

2624-
return self.execute_command("BLMPOP", *args)
2622+
return self.execute_command("BLMPOP", *cmd_args)
26252623

26262624
def lmpop(
26272625
self,
26282626
num_keys: int,
2629-
*args: List[str],
2627+
*args: str,
26302628
direction: str,
26312629
count: Optional[int] = 1,
26322630
) -> Union[Awaitable[list], list]:
@@ -2636,11 +2634,11 @@ def lmpop(
26362634
26372635
For more information, see https://redis.io/commands/lmpop
26382636
"""
2639-
args = [num_keys] + list(args) + [direction]
2637+
cmd_args = [num_keys] + list(args) + [direction]
26402638
if count != 1:
2641-
args.extend(["COUNT", count])
2639+
cmd_args.extend(["COUNT", count])
26422640

2643-
return self.execute_command("LMPOP", *args)
2641+
return self.execute_command("LMPOP", *cmd_args)
26442642

26452643
def lindex(
26462644
self, name: str, index: int

redis/commands/json/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class JSONCommands:
1414
"""json commands."""
1515

1616
def arrappend(
17-
self, name: str, path: Optional[str] = Path.root_path(), *args: List[JsonType]
17+
self, name: str, path: Optional[str] = Path.root_path(), *args: JsonType
1818
) -> List[Optional[int]]:
1919
"""Append the objects ``args`` to the array under the
2020
``path` in key ``name``.
@@ -52,7 +52,7 @@ def arrindex(
5252
return self.execute_command("JSON.ARRINDEX", *pieces, keys=[name])
5353

5454
def arrinsert(
55-
self, name: str, path: str, index: int, *args: List[JsonType]
55+
self, name: str, path: str, index: int, *args: JsonType
5656
) -> List[Optional[int]]:
5757
"""Insert the objects ``args`` to the array at index ``index``
5858
under the ``path` in key ``name``.

0 commit comments

Comments
 (0)