Skip to content

Commit ef899db

Browse files
committed
fix naming convention in rootPath
1 parent 5ba8d91 commit ef899db

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

docs/examples/search_json_examples.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
" \"city\": \"Tel Aviv\"\n",
6060
" }\n",
6161
"}\n",
62-
"r.json().set(\"user:1\", Path.rootPath(), user1)\n",
63-
"r.json().set(\"user:2\", Path.rootPath(), user2)\n",
64-
"r.json().set(\"user:3\", Path.rootPath(), user3)\n",
62+
"r.json().set(\"user:1\", Path.root_path(), user1)\n",
63+
"r.json().set(\"user:2\", Path.root_path(), user2)\n",
64+
"r.json().set(\"user:3\", Path.root_path(), user3)\n",
6565
"\n",
6666
"schema = (TextField(\"$.user.name\", as_name=\"name\"),TagField(\"$.user.city\", as_name=\"city\"), NumericField(\"$.user.age\", as_name=\"age\"))\n",
6767
"r.ft().create_index(schema, definition=IndexDefinition(prefix=[\"user:\"], index_type=IndexType.JSON))"

redis/commands/json/commands.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class JSONCommands:
1515
"""json commands."""
1616

1717
def arrappend(
18-
self, name: str, path: Optional[str] = Path.rootPath(), *args: List[JsonType]
18+
self, name: str, path: Optional[str] = Path.root_path(), *args: List[JsonType]
1919
) -> List[Union[int, None]]:
2020
"""Append the objects ``args`` to the array under the
2121
``path` in key ``name``.
@@ -62,7 +62,7 @@ def arrinsert(
6262
return self.execute_command("JSON.ARRINSERT", *pieces)
6363

6464
def arrlen(
65-
self, name: str, path: Optional[str] = Path.rootPath()
65+
self, name: str, path: Optional[str] = Path.root_path()
6666
) -> List[Union[int, None]]:
6767
"""Return the length of the array JSON value under ``path``
6868
at key``name``.
@@ -74,7 +74,7 @@ def arrlen(
7474
def arrpop(
7575
self,
7676
name: str,
77-
path: Optional[str] = Path.rootPath(),
77+
path: Optional[str] = Path.root_path(),
7878
index: Optional[int] = -1,
7979
) -> List[Union[str, None]]:
8080

@@ -95,23 +95,22 @@ def arrtrim(
9595
""" # noqa
9696
return self.execute_command("JSON.ARRTRIM", name, str(path), start, stop)
9797

98-
def type(self, name: str, path: Optional[str] = Path.rootPath()) -> List[str]:
99-
98+
def type(self, name: str, path: Optional[str] = Path.root_path()) -> List[str]:
10099
"""Get the type of the JSON value under ``path`` from key ``name``.
101100
102101
For more information: https://oss.redis.com/redisjson/commands/#jsontype
103102
""" # noqa
104103
return self.execute_command("JSON.TYPE", name, str(path))
105104

106-
def resp(self, name: str, path: Optional[str] = Path.rootPath()) -> List:
105+
def resp(self, name: str, path: Optional[str] = Path.root_path()) -> List:
107106
"""Return the JSON value under ``path`` at key ``name``.
108107
109108
For more information: https://oss.redis.com/redisjson/commands/#jsonresp
110109
""" # noqa
111110
return self.execute_command("JSON.RESP", name, str(path))
112111

113112
def objkeys(
114-
self, name: str, path: Optional[str] = Path.rootPath()
113+
self, name: str, path: Optional[str] = Path.root_path()
115114
) -> List[Union[List[str], None]]:
116115
"""Return the key names in the dictionary JSON value under ``path`` at
117116
key ``name``.
@@ -120,7 +119,7 @@ def objkeys(
120119
""" # noqa
121120
return self.execute_command("JSON.OBJKEYS", name, str(path))
122121

123-
def objlen(self, name: str, path: Optional[str] = Path.rootPath()) -> int:
122+
def objlen(self, name: str, path: Optional[str] = Path.root_path()) -> int:
124123
"""Return the length of the dictionary JSON value under ``path`` at key
125124
``name``.
126125
@@ -149,7 +148,7 @@ def nummultby(self, name: str, path: str, number: int) -> str:
149148
"JSON.NUMMULTBY", name, str(path), self._encode(number)
150149
)
151150

152-
def clear(self, name: str, path: Optional[str] = Path.rootPath()) -> int:
151+
def clear(self, name: str, path: Optional[str] = Path.root_path()) -> int:
153152
"""
154153
Empty arrays and objects (to have zero slots/keys without deleting the
155154
array/object).
@@ -161,7 +160,7 @@ def clear(self, name: str, path: Optional[str] = Path.rootPath()) -> int:
161160
""" # noqa
162161
return self.execute_command("JSON.CLEAR", name, str(path))
163162

164-
def delete(self, key: str, path: Optional[str] = Path.rootPath()) -> int:
163+
def delete(self, key: str, path: Optional[str] = Path.root_path()) -> int:
165164
"""Delete the JSON value stored at key ``key`` under ``path``.
166165
167166
For more information: https://oss.redis.com/redisjson/commands/#jsondel
@@ -327,7 +326,7 @@ def strlen(self, name: str, path: Optional[str] = None) -> List[Union[int, None]
327326
return self.execute_command("JSON.STRLEN", *pieces)
328327

329328
def toggle(
330-
self, name: str, path: Optional[str] = Path.rootPath()
329+
self, name: str, path: Optional[str] = Path.root_path()
331330
) -> Union[bool, List[Optional[int]]]:
332331
"""Toggle boolean value under ``path`` at key ``name``.
333332
returning the new value.
@@ -337,7 +336,7 @@ def toggle(
337336
return self.execute_command("JSON.TOGGLE", name, str(path))
338337

339338
def strappend(
340-
self, name: str, value: str, path: Optional[int] = Path.rootPath()
339+
self, name: str, value: str, path: Optional[int] = Path.root_path()
341340
) -> Union[int, List[Optional[int]]]:
342341
"""Append to the string JSON value. If two options are specified after
343342
the key name, the path is determined to be the first. If a single
@@ -352,7 +351,7 @@ def debug(
352351
self,
353352
subcommand: str,
354353
key: Optional[str] = None,
355-
path: Optional[str] = Path.rootPath(),
354+
path: Optional[str] = Path.root_path(),
356355
) -> Union[int, List[str]]:
357356
"""Return the memory usage in bytes of a value under ``path`` from
358357
key ``name``.

0 commit comments

Comments
 (0)