mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 20:36:10 +02:00
Use range() instead of xrange()
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
cad8261b30
commit
8698e09839
@ -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):]
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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'])
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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])
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user