diff options
author | Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> | 2015-04-10 15:43:42 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-04-14 05:19:56 +0900 |
commit | 8698e09839a2f97f21e08f015d480748e14cb6ef (patch) | |
tree | 1069ef8a5ad0aac9dc506a292f0a7ebcf77b87ad | |
parent | cad8261b30d742673b71dd664731a7db3bd64566 (diff) |
Use range() instead of xrange()
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/bgp.py | 2 | ||||
-rw-r--r-- | ryu/lib/type_desc.py | 4 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/operator/command.py | 2 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/peer.py | 2 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/rtconf/vrfs.py | 2 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/signals/base.py | 2 | ||||
-rw-r--r-- | ryu/tests/integrated/vrrp_common.py | 2 | ||||
-rw-r--r-- | ryu/tests/unit/ofproto/test_parser_ofpmatch.py | 2 |
8 files changed, 9 insertions, 9 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index 81feef31..84de1e12 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -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):] diff --git a/ryu/lib/type_desc.py b/ryu/lib/type_desc.py index c50d2e66..4aa6fc09 100644 --- a/ryu/lib/type_desc.py +++ b/ryu/lib/type_desc.py @@ -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 diff --git a/ryu/services/protocols/bgp/operator/command.py b/ryu/services/protocols/bgp/operator/command.py index ccb445fe..5afa5b0f 100644 --- a/ryu/services/protocols/bgp/operator/command.py +++ b/ryu/services/protocols/bgp/operator/command.py @@ -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']) diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py index d97a53b6..86863ea9 100644 --- a/ryu/services/protocols/bgp/peer.py +++ b/ryu/services/protocols/bgp/peer.py @@ -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: diff --git a/ryu/services/protocols/bgp/rtconf/vrfs.py b/ryu/services/protocols/bgp/rtconf/vrfs.py index 36dd2f9b..9cbfe998 100644 --- a/ryu/services/protocols/bgp/rtconf/vrfs.py +++ b/ryu/services/protocols/bgp/rtconf/vrfs.py @@ -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]) diff --git a/ryu/services/protocols/bgp/signals/base.py b/ryu/services/protocols/bgp/signals/base.py index 3ccbe1a0..2099d7ec 100644 --- a/ryu/services/protocols/bgp/signals/base.py +++ b/ryu/services/protocols/bgp/signals/base.py @@ -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, diff --git a/ryu/tests/integrated/vrrp_common.py b/ryu/tests/integrated/vrrp_common.py index 0f06806a..1f88dc0d 100644 --- a/ryu/tests/integrated/vrrp_common.py +++ b/ryu/tests/integrated/vrrp_common.py @@ -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) diff --git a/ryu/tests/unit/ofproto/test_parser_ofpmatch.py b/ryu/tests/unit/ofproto/test_parser_ofpmatch.py index 2b64cdbe..4b2d0338 100644 --- a/ryu/tests/unit/ofproto/test_parser_ofpmatch.py +++ b/ryu/tests/unit/ofproto/test_parser_ofpmatch.py @@ -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 = [] |