From 4e8da6f6a644bfbb963cd5054822cebc10f12525 Mon Sep 17 00:00:00 2001 From: Grokzen Date: Fri, 26 Dec 2014 20:20:33 +0100 Subject: [PATCH] No flake8 warnings/errors on xrange that uses redis-py _compat variables --- benchmarks/simple.py | 4 ++-- rediscluster/pipeline.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmarks/simple.py b/benchmarks/simple.py index e460b26e..7f651d20 100644 --- a/benchmarks/simple.py +++ b/benchmarks/simple.py @@ -25,7 +25,7 @@ def loop(rc, reset_last_key=None): print("error {0}".format(e)) time.sleep(1) - for i in xrange(last, 1000000000): + for i in xrange(last, 1000000000): # noqa try: print("SET foo{0} {1}".format(i, i)) rc.set("foo{0}".format(i), i) @@ -42,7 +42,7 @@ def timeit(rc, itterations=50000): """ Time how long it take to run a number of set/get:s """ t0 = time.time() - for i in xrange(0, itterations): + for i in xrange(0, itterations): # noqa try: s = "foo{0}".format(i) rc.set(s, i) diff --git a/rediscluster/pipeline.py b/rediscluster/pipeline.py index 83f14d15..4245bbbe 100644 --- a/rediscluster/pipeline.py +++ b/rediscluster/pipeline.py @@ -123,7 +123,7 @@ def send_cluster_commands(self, stack, raise_on_error=True, allow_redirections=T ttl = self.RedisClusterRequestTTL response = {} - attempt = range(0, len(stack)) if stack else [] + attempt = xrange(0, len(stack)) if stack else [] # noqa ask_slots = {} while attempt and ttl > 0: @@ -239,7 +239,7 @@ def _execute_pipeline(self, connection, commands, raise_on_error): try: connection.send_packed_command(all_cmds) except ConnectionError as e: - return [e for _ in xrange(len(commands))] + return [e for _ in xrange(len(commands))] # noqa response = [] for args, options in commands: