Skip to content

Commit 518801e

Browse files
committed
add repr_command(), a function to consistently represent commands
1 parent db74ce9 commit 518801e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

redis/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ def dict_merge(*dicts):
159159
[merged.update(d) for d in dicts]
160160
return merged
161161

162+
def repr_command(args):
163+
"Represents a command as a string."
164+
command = [args[0]]
165+
if len(args) > 1:
166+
command.extend(repr(x) for x in args[1:])
167+
168+
return ' '.join(command)
169+
162170
def parse_info(response):
163171
"Parse the result of Redis's INFO command into a Python dict"
164172
info = {}

0 commit comments

Comments
 (0)