Merge "py3: Replaces xrange() with six.moves.range()"

This commit is contained in:
Jenkins 2016-01-21 07:57:27 +00:00 committed by Gerrit Code Review
commit 2ae5196747
2 changed files with 3 additions and 2 deletions

View File

@ -143,7 +143,7 @@ class PikaPoller(object):
LOG.exception("Unexpected error during closing connection") LOG.exception("Unexpected error during closing connection")
self._connection = None self._connection = None
for i in xrange(len(self._message_queue) - 1, -1, -1): for i in six.moves.range(len(self._message_queue) - 1, -1, -1):
message = self._message_queue[i] message = self._message_queue[i]
if message.need_ack(): if message.need_ack():
del self._message_queue[i] del self._message_queue[i]

View File

@ -20,6 +20,7 @@ import itertools
import logging import logging
import os import os
import random import random
import six
import string import string
import sys import sys
import threading import threading
@ -274,7 +275,7 @@ def send_msg(c_id, transport, target, wait_after_msg, timeout, is_cast,
client.send_msg() client.send_msg()
else: else:
LOG.debug("Sending %d messages using client %d", messages_count, c_id) LOG.debug("Sending %d messages using client %d", messages_count, c_id)
for _ in xrange(0, messages_count): for _ in six.moves.range(0, messages_count):
client.send_msg() client.send_msg()
LOG.debug("Client %d has sent %d messages", c_id, messages_count) LOG.debug("Client %d has sent %d messages", c_id, messages_count)