summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorandy <andy@andymccurdy.com>2011-10-24 12:43:30 -0700
committerandy <andy@andymccurdy.com>2011-10-24 12:43:30 -0700
commit4e18978b8eb4c8d70e26ba8a2c9209454495023b (patch)
tree92a993511c4c5f60be0888c87a8eff9f6cb8706c /redis/client.py
parent86fab8c48a1091a89deb4334e320fe2fe8d1a6b5 (diff)
downloadredis-py-4e18978b8eb4c8d70e26ba8a2c9209454495023b.tar.gz
Fix spacing from DEBUG OBJECT pull request.
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/redis/client.py b/redis/client.py
index 5a03231..826f86f 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -45,22 +45,25 @@ def dict_merge(*dicts):
return merged
def parse_debug_object(response):
- "Parse the results of Redis's DEBUG OBJECT command into a Python dict"
- res = dict([kv.split(':') for kv in ('type:' + response).split()])
-
- # parse some expected int values from the string response
- # note: this cmd isn't spec'd so these may not appear in all redis versions
- possible_int_fields = ['refcount', 'serializedlength',
- 'lru', 'lru_seconds_idle']
- for field in possible_int_fields:
- if field in res:
- res[field] = int(res[field])
-
- return res
+ "Parse the results of Redis's DEBUG OBJECT command into a Python dict"
+ # The 'type' of the object is the first item in the response, but isn't
+ # prefixed with a name
+ response = 'type:' + response
+ response = dict([kv.split(':') for kv in response.split()])
+
+ # parse some expected int values from the string response
+ # note: this cmd isn't spec'd so these may not appear in all redis versions
+ int_fields = ('refcount', 'serializedlength', 'lru', 'lru_seconds_idle')
+ for field in int_fields:
+ if field in response:
+ response[field] = int(response[field])
+
+ return response
def parse_info(response):
"Parse the result of Redis's INFO command into a Python dict"
info = {}
+
def get_value(value):
if ',' not in value:
return value
@@ -165,7 +168,7 @@ class StrictRedis(object):
'CONFIG': parse_config,
'HGETALL': lambda r: r and pairs_to_dict(r) or {},
'INFO': parse_info,
- 'DEBUG' : parse_debug_object,
+ 'DEBUG': parse_debug_object,
'LASTSAVE': timestamp_to_datetime,
'PING': lambda r: r == 'PONG',
'RANDOMKEY': lambda r: r and r or None,
@@ -325,8 +328,8 @@ class StrictRedis(object):
return self.execute_command('INFO')
def debug_object(self, key):
- """Returns version specific metainformation about a give key"""
- return self.execute_command('DEBUG', 'OBJECT', key)
+ "Returns version specific metainformation about a give key"
+ return self.execute_command('DEBUG', 'OBJECT', key)
def lastsave(self):
"""