Skip to content

Commit ce6d7b4

Browse files
parmenashpdvora-h
authored andcommitted
Fix return types in json commands (#3071)
* Fix return types in JSONCommands class * Update CHANGES
1 parent b7dbb7e commit ce6d7b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands
12
* Connection.register_connect_callback() is made public.
23
* Fix async `read_response` to use `disable_decoding`.
34
* Add 'aclose()' methods to async classes, deprecate async close().

redis/commands/json/commands.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def delete(self, key: str, path: Optional[str] = Path.root_path()) -> int:
173173

174174
def get(
175175
self, name: str, *args, no_escape: Optional[bool] = False
176-
) -> List[JsonType]:
176+
) -> Optional[List[JsonType]]:
177177
"""
178178
Get the object stored as a JSON value at key ``name``.
179179
@@ -324,7 +324,7 @@ def set_path(
324324
nx: Optional[bool] = False,
325325
xx: Optional[bool] = False,
326326
decode_keys: Optional[bool] = False,
327-
) -> List[Dict[str, bool]]:
327+
) -> Dict[str, bool]:
328328
"""
329329
Iterate over ``root_folder`` and set each JSON file to a value
330330
under ``json_path`` with the file name as the key.
@@ -377,7 +377,7 @@ def toggle(
377377
return self.execute_command("JSON.TOGGLE", name, str(path))
378378

379379
def strappend(
380-
self, name: str, value: str, path: Optional[int] = Path.root_path()
380+
self, name: str, value: str, path: Optional[str] = Path.root_path()
381381
) -> Union[int, List[Optional[int]]]:
382382
"""Append to the string JSON value. If two options are specified after
383383
the key name, the path is determined to be the first. If a single

0 commit comments

Comments
 (0)