Skip to content

Commit

Permalink
Fix return types in json commands (#3071)
Browse files Browse the repository at this point in the history
* Fix return types in JSONCommands class

* Update CHANGES
  • Loading branch information
parmenashp authored and vladvildanov committed Sep 27, 2024
1 parent 8c982d8 commit 0aae9c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands
* Connection.register_connect_callback() is made public.
* Fix async `read_response` to use `disable_decoding`.
* Add 'aclose()' methods to async classes, deprecate async close().
Expand Down
6 changes: 3 additions & 3 deletions redis/commands/json/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def delete(self, key: str, path: Optional[str] = Path.root_path()) -> int:

def get(
self, name: str, *args, no_escape: Optional[bool] = False
) -> List[JsonType]:
) -> Optional[List[JsonType]]:
"""
Get the object stored as a JSON value at key ``name``.
Expand Down Expand Up @@ -324,7 +324,7 @@ def set_path(
nx: Optional[bool] = False,
xx: Optional[bool] = False,
decode_keys: Optional[bool] = False,
) -> List[Dict[str, bool]]:
) -> Dict[str, bool]:
"""
Iterate over ``root_folder`` and set each JSON file to a value
under ``json_path`` with the file name as the key.
Expand Down Expand Up @@ -377,7 +377,7 @@ def toggle(
return self.execute_command("JSON.TOGGLE", name, str(path))

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

0 comments on commit 0aae9c0

Please sign in to comment.