Skip to content
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

Fix return types in json commands #3071

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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