@@ -45,22 +45,25 @@ def dict_merge(*dicts):
45
45
return merged
46
46
47
47
def parse_debug_object (response ):
48
- "Parse the results of Redis's DEBUG OBJECT command into a Python dict"
49
- res = dict ([kv .split (':' ) for kv in ('type:' + response ).split ()])
50
-
51
- # parse some expected int values from the string response
52
- # note: this cmd isn't spec'd so these may not appear in all redis versions
53
- possible_int_fields = ['refcount' , 'serializedlength' ,
54
- 'lru' , 'lru_seconds_idle' ]
55
- for field in possible_int_fields :
56
- if field in res :
57
- res [field ] = int (res [field ])
58
-
59
- return res
48
+ "Parse the results of Redis's DEBUG OBJECT command into a Python dict"
49
+ # The 'type' of the object is the first item in the response, but isn't
50
+ # prefixed with a name
51
+ response = 'type:' + response
52
+ response = dict ([kv .split (':' ) for kv in response .split ()])
53
+
54
+ # parse some expected int values from the string response
55
+ # note: this cmd isn't spec'd so these may not appear in all redis versions
56
+ int_fields = ('refcount' , 'serializedlength' , 'lru' , 'lru_seconds_idle' )
57
+ for field in int_fields :
58
+ if field in response :
59
+ response [field ] = int (response [field ])
60
+
61
+ return response
60
62
61
63
def parse_info (response ):
62
64
"Parse the result of Redis's INFO command into a Python dict"
63
65
info = {}
66
+
64
67
def get_value (value ):
65
68
if ',' not in value :
66
69
return value
@@ -165,7 +168,7 @@ class StrictRedis(object):
165
168
'CONFIG' : parse_config ,
166
169
'HGETALL' : lambda r : r and pairs_to_dict (r ) or {},
167
170
'INFO' : parse_info ,
168
- 'DEBUG' : parse_debug_object ,
171
+ 'DEBUG' : parse_debug_object ,
169
172
'LASTSAVE' : timestamp_to_datetime ,
170
173
'PING' : lambda r : r == 'PONG' ,
171
174
'RANDOMKEY' : lambda r : r and r or None ,
@@ -325,8 +328,8 @@ def info(self):
325
328
return self .execute_command ('INFO' )
326
329
327
330
def debug_object (self , key ):
328
- """ Returns version specific metainformation about a give key"" "
329
- return self .execute_command ('DEBUG' , 'OBJECT' , key )
331
+ " Returns version specific metainformation about a give key"
332
+ return self .execute_command ('DEBUG' , 'OBJECT' , key )
330
333
331
334
def lastsave (self ):
332
335
"""
0 commit comments