@@ -15,7 +15,7 @@ class JSONCommands:
15
15
"""json commands."""
16
16
17
17
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 ]
19
19
) -> List [Union [int , None ]]:
20
20
"""Append the objects ``args`` to the array under the
21
21
``path` in key ``name``.
@@ -62,7 +62,7 @@ def arrinsert(
62
62
return self .execute_command ("JSON.ARRINSERT" , * pieces )
63
63
64
64
def arrlen (
65
- self , name : str , path : Optional [str ] = Path .rootPath ()
65
+ self , name : str , path : Optional [str ] = Path .root_path ()
66
66
) -> List [Union [int , None ]]:
67
67
"""Return the length of the array JSON value under ``path``
68
68
at key``name``.
@@ -74,7 +74,7 @@ def arrlen(
74
74
def arrpop (
75
75
self ,
76
76
name : str ,
77
- path : Optional [str ] = Path .rootPath (),
77
+ path : Optional [str ] = Path .root_path (),
78
78
index : Optional [int ] = - 1 ,
79
79
) -> List [Union [str , None ]]:
80
80
@@ -95,23 +95,22 @@ def arrtrim(
95
95
""" # noqa
96
96
return self .execute_command ("JSON.ARRTRIM" , name , str (path ), start , stop )
97
97
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 ]:
100
99
"""Get the type of the JSON value under ``path`` from key ``name``.
101
100
102
101
For more information: https://oss.redis.com/redisjson/commands/#jsontype
103
102
""" # noqa
104
103
return self .execute_command ("JSON.TYPE" , name , str (path ))
105
104
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 :
107
106
"""Return the JSON value under ``path`` at key ``name``.
108
107
109
108
For more information: https://oss.redis.com/redisjson/commands/#jsonresp
110
109
""" # noqa
111
110
return self .execute_command ("JSON.RESP" , name , str (path ))
112
111
113
112
def objkeys (
114
- self , name : str , path : Optional [str ] = Path .rootPath ()
113
+ self , name : str , path : Optional [str ] = Path .root_path ()
115
114
) -> List [Union [List [str ], None ]]:
116
115
"""Return the key names in the dictionary JSON value under ``path`` at
117
116
key ``name``.
@@ -120,7 +119,7 @@ def objkeys(
120
119
""" # noqa
121
120
return self .execute_command ("JSON.OBJKEYS" , name , str (path ))
122
121
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 :
124
123
"""Return the length of the dictionary JSON value under ``path`` at key
125
124
``name``.
126
125
@@ -149,7 +148,7 @@ def nummultby(self, name: str, path: str, number: int) -> str:
149
148
"JSON.NUMMULTBY" , name , str (path ), self ._encode (number )
150
149
)
151
150
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 :
153
152
"""
154
153
Empty arrays and objects (to have zero slots/keys without deleting the
155
154
array/object).
@@ -161,7 +160,7 @@ def clear(self, name: str, path: Optional[str] = Path.rootPath()) -> int:
161
160
""" # noqa
162
161
return self .execute_command ("JSON.CLEAR" , name , str (path ))
163
162
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 :
165
164
"""Delete the JSON value stored at key ``key`` under ``path``.
166
165
167
166
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]
327
326
return self .execute_command ("JSON.STRLEN" , * pieces )
328
327
329
328
def toggle (
330
- self , name : str , path : Optional [str ] = Path .rootPath ()
329
+ self , name : str , path : Optional [str ] = Path .root_path ()
331
330
) -> Union [bool , List [Optional [int ]]]:
332
331
"""Toggle boolean value under ``path`` at key ``name``.
333
332
returning the new value.
@@ -337,7 +336,7 @@ def toggle(
337
336
return self .execute_command ("JSON.TOGGLE" , name , str (path ))
338
337
339
338
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 ()
341
340
) -> Union [int , List [Optional [int ]]]:
342
341
"""Append to the string JSON value. If two options are specified after
343
342
the key name, the path is determined to be the first. If a single
@@ -352,7 +351,7 @@ def debug(
352
351
self ,
353
352
subcommand : str ,
354
353
key : Optional [str ] = None ,
355
- path : Optional [str ] = Path .rootPath (),
354
+ path : Optional [str ] = Path .root_path (),
356
355
) -> Union [int , List [str ]]:
357
356
"""Return the memory usage in bytes of a value under ``path`` from
358
357
key ``name``.
0 commit comments