Use range() instead of xrange()

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Kobayashi 2015-04-10 15:43:42 +09:00 committed by FUJITA Tomonori
parent cad8261b30
commit 8698e09839
8 changed files with 9 additions and 9 deletions

View File

@ -1490,7 +1490,7 @@ class _BGPPathAttributeAsPathCommon(_PathAttribute):
buffer(buf))
buf = buf[struct.calcsize(cls._SEG_HDR_PACK_STR):]
l = []
for i in xrange(0, num_as):
for i in range(0, num_as):
(as_number,) = struct.unpack_from(as_pack_str,
buffer(buf))
buf = buf[struct.calcsize(as_pack_str):]

View File

@ -28,7 +28,7 @@ class IntDescr(TypeDescr):
def to_user(self, bin):
i = 0
for x in xrange(self.size):
for x in range(self.size):
c = bin[:1]
i = i * 256 + ord(c)
bin = bin[1:]
@ -36,7 +36,7 @@ class IntDescr(TypeDescr):
def from_user(self, i):
bin = ''
for x in xrange(self.size):
for x in range(self.size):
bin = chr(i & 255) + bin
i /= 256
return bin

View File

@ -4,7 +4,7 @@ import logging
import pprint
import re
(STATUS_OK, STATUS_ERROR) = xrange(2)
(STATUS_OK, STATUS_ERROR) = range(2)
CommandsResponse = namedtuple('CommandsResponse', ['status', 'value'])

View File

@ -1198,7 +1198,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
def flatten(L):
if isinstance(L, list):
for i in xrange(len(L)):
for i in range(len(L)):
for e in flatten(L[i]):
yield e
else:

View File

@ -388,7 +388,7 @@ class VrfConf(ConfWithId, ConfWithStats):
class VrfsConf(BaseConf):
"""Container for all VRF configurations."""
ADD_VRF_CONF_EVT, REMOVE_VRF_CONF_EVT = xrange(2)
ADD_VRF_CONF_EVT, REMOVE_VRF_CONF_EVT = range(2)
VALID_EVT = frozenset([ADD_VRF_CONF_EVT, REMOVE_VRF_CONF_EVT])

View File

@ -15,7 +15,7 @@ class SignalBus(object):
def register_listener(self, identifier, func, filter_func=None):
identifier = _to_tuple(identifier)
substrings = (identifier[:i] for i in xrange(1, len(identifier) + 1))
substrings = (identifier[:i] for i in range(1, len(identifier) + 1))
for partial_id in substrings:
self._listeners.setdefault(
partial_id,

View File

@ -116,7 +116,7 @@ class VRRPCommon(app_manager.RyuApp):
step = 5
instances = {}
for vrid in xrange(1, 256, step):
for vrid in range(1, 256, step):
if vrid == _VRID:
continue
print("vrid %s" % vrid)

View File

@ -194,7 +194,7 @@ def _add_tests():
flatten = lambda l: reduce(flatten_one, l, [])
for ofpp in ofpps:
for n in xrange(1, 3):
for n in range(1, 3):
for C in itertools.combinations(L[ofpp], n):
l = [1]
keys = []