3
3
from redis .utils import str_if_bytes
4
4
5
5
6
- def timestamp_to_datetime (response ):
6
+ def timestamp_to_datetime (response , ** options ):
7
7
"Converts a unix timestamp to a Python datetime object"
8
8
if not response :
9
9
return None
@@ -14,7 +14,7 @@ def timestamp_to_datetime(response):
14
14
return datetime .datetime .fromtimestamp (response )
15
15
16
16
17
- def parse_debug_object (response ):
17
+ def parse_debug_object (response , ** options ):
18
18
"Parse the results of Redis's DEBUG OBJECT command into a Python dict"
19
19
# The 'type' of the object is the first item in the response, but isn't
20
20
# prefixed with a name
@@ -32,7 +32,7 @@ def parse_debug_object(response):
32
32
return response
33
33
34
34
35
- def parse_info (response ):
35
+ def parse_info (response , ** options ):
36
36
"""Parse the result of Redis's INFO command into a Python dict"""
37
37
info = {}
38
38
response = str_if_bytes (response )
@@ -121,7 +121,7 @@ def parse_memory_stats(response, **kwargs):
121
121
}
122
122
123
123
124
- def parse_sentinel_state (item ):
124
+ def parse_sentinel_state (item , ** options ):
125
125
result = pairs_to_dict_typed (item , SENTINEL_STATE_TYPES )
126
126
flags = set (result ["flags" ].split ("," ))
127
127
for name , flag in (
@@ -137,11 +137,11 @@ def parse_sentinel_state(item):
137
137
return result
138
138
139
139
140
- def parse_sentinel_master (response ):
140
+ def parse_sentinel_master (response , ** options ):
141
141
return parse_sentinel_state (map (str_if_bytes , response ))
142
142
143
143
144
- def parse_sentinel_state_resp3 (response ):
144
+ def parse_sentinel_state_resp3 (response , ** options ):
145
145
result = {}
146
146
for key in response :
147
147
try :
@@ -154,27 +154,27 @@ def parse_sentinel_state_resp3(response):
154
154
return result
155
155
156
156
157
- def parse_sentinel_masters (response ):
157
+ def parse_sentinel_masters (response , ** options ):
158
158
result = {}
159
159
for item in response :
160
160
state = parse_sentinel_state (map (str_if_bytes , item ))
161
161
result [state ["name" ]] = state
162
162
return result
163
163
164
164
165
- def parse_sentinel_masters_resp3 (response ):
165
+ def parse_sentinel_masters_resp3 (response , ** options ):
166
166
return [parse_sentinel_state (master ) for master in response ]
167
167
168
168
169
- def parse_sentinel_slaves_and_sentinels (response ):
169
+ def parse_sentinel_slaves_and_sentinels (response , ** options ):
170
170
return [parse_sentinel_state (map (str_if_bytes , item )) for item in response ]
171
171
172
172
173
- def parse_sentinel_slaves_and_sentinels_resp3 (response ):
173
+ def parse_sentinel_slaves_and_sentinels_resp3 (response , ** options ):
174
174
return [parse_sentinel_state_resp3 (item ) for item in response ]
175
175
176
176
177
- def parse_sentinel_get_master (response ):
177
+ def parse_sentinel_get_master (response , ** options ):
178
178
return response and (response [0 ], int (response [1 ])) or None
179
179
180
180
@@ -235,7 +235,7 @@ def sort_return_tuples(response, **options):
235
235
return list (zip (* [response [i ::n ] for i in range (n )]))
236
236
237
237
238
- def parse_stream_list (response ):
238
+ def parse_stream_list (response , ** options ):
239
239
if response is None :
240
240
return None
241
241
data = []
@@ -247,11 +247,11 @@ def parse_stream_list(response):
247
247
return data
248
248
249
249
250
- def pairs_to_dict_with_str_keys (response ):
250
+ def pairs_to_dict_with_str_keys (response , ** options ):
251
251
return pairs_to_dict (response , decode_keys = True )
252
252
253
253
254
- def parse_list_of_dicts (response ):
254
+ def parse_list_of_dicts (response , ** options ):
255
255
return list (map (pairs_to_dict_with_str_keys , response ))
256
256
257
257
@@ -299,13 +299,13 @@ def parse_xinfo_stream(response, **options):
299
299
return data
300
300
301
301
302
- def parse_xread (response ):
302
+ def parse_xread (response , ** options ):
303
303
if response is None :
304
304
return []
305
305
return [[r [0 ], parse_stream_list (r [1 ])] for r in response ]
306
306
307
307
308
- def parse_xread_resp3 (response ):
308
+ def parse_xread_resp3 (response , ** options ):
309
309
if response is None :
310
310
return {}
311
311
return {key : [parse_stream_list (value )] for key , value in response .items ()}
@@ -323,12 +323,12 @@ def parse_xpending(response, **options):
323
323
}
324
324
325
325
326
- def parse_xpending_range (response ):
326
+ def parse_xpending_range (response , ** options ):
327
327
k = ("message_id" , "consumer" , "time_since_delivered" , "times_delivered" )
328
328
return [dict (zip (k , r )) for r in response ]
329
329
330
330
331
- def float_or_none (response ):
331
+ def float_or_none (response , ** options ):
332
332
if response is None :
333
333
return None
334
334
return float (response )
0 commit comments