summaryrefslogtreecommitdiff
path: root/benchmarks/command_packer_benchmark.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-11-02 06:30:07 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2018-11-03 03:21:49 -0700
commit5089cc275e6077a070017587001c22e490995d47 (patch)
treeeb8e52047d04f36f1a9562fa47e0a853ffab79eb /benchmarks/command_packer_benchmark.py
parent7a0e4c7f99463c79b456a48837b5687072e1485d (diff)
downloadredis-py-5089cc275e6077a070017587001c22e490995d47.tar.gz
Use unicode literals throughout project
Remove workaround for handling unicode with older Pythons.
Diffstat (limited to 'benchmarks/command_packer_benchmark.py')
-rw-r--r--benchmarks/command_packer_benchmark.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/benchmarks/command_packer_benchmark.py b/benchmarks/command_packer_benchmark.py
index 9eb1853..0d69bdf 100644
--- a/benchmarks/command_packer_benchmark.py
+++ b/benchmarks/command_packer_benchmark.py
@@ -29,10 +29,11 @@ class StringJoiningConnection(Connection):
def pack_command(self, *args):
"Pack a series of arguments into a value Redis command"
args_output = SYM_EMPTY.join([
- SYM_EMPTY.join((SYM_DOLLAR, b(str(len(k))), SYM_CRLF, k, SYM_CRLF))
+ SYM_EMPTY.join(
+ (SYM_DOLLAR, str(len(k)).encode(), SYM_CRLF, k, SYM_CRLF))
for k in imap(self.encoder.encode, args)])
output = SYM_EMPTY.join(
- (SYM_STAR, b(str(len(args))), SYM_CRLF, args_output))
+ (SYM_STAR, str(len(args)).encode(), SYM_CRLF, args_output))
return output
@@ -61,17 +62,17 @@ class ListJoiningConnection(Connection):
def pack_command(self, *args):
output = []
buff = SYM_EMPTY.join(
- (SYM_STAR, b(str(len(args))), SYM_CRLF))
+ (SYM_STAR, str(len(args)).encode(), SYM_CRLF))
for k in imap(self.encoder.encode, args):
if len(buff) > 6000 or len(k) > 6000:
buff = SYM_EMPTY.join(
- (buff, SYM_DOLLAR, b(str(len(k))), SYM_CRLF))
+ (buff, SYM_DOLLAR, str(len(k)).encode(), SYM_CRLF))
output.append(buff)
output.append(k)
buff = SYM_CRLF
else:
- buff = SYM_EMPTY.join((buff, SYM_DOLLAR, b(str(len(k))),
+ buff = SYM_EMPTY.join((buff, SYM_DOLLAR, str(len(k)).encode(),
SYM_CRLF, k, SYM_CRLF))
output.append(buff)
return output