py3: use function next() instead of next() method on iterator objects
Python 3 introduced a next() function to replace the next() method on iterator objects. Ref: http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html#next TrivialFix Change-Id: Ic36d89dd5031a29744323df4e44d5b32d67c1b77
This commit is contained in:
parent
8b0d413b1c
commit
3fe3dfe6a1
|
@ -450,13 +450,13 @@ class IpRouteCommand(IpDeviceCommandBase):
|
||||||
'match', subnet).split('\n')
|
'match', subnet).split('\n')
|
||||||
for subnet_route_line in subnet_route_list_lines:
|
for subnet_route_line in subnet_route_list_lines:
|
||||||
i = iter(subnet_route_line.split())
|
i = iter(subnet_route_line.split())
|
||||||
while(i.next() != 'dev'):
|
while(next(i) != 'dev'):
|
||||||
pass
|
pass
|
||||||
device = i.next()
|
device = next(i)
|
||||||
try:
|
try:
|
||||||
while(i.next() != 'src'):
|
while(next(i) != 'src'):
|
||||||
pass
|
pass
|
||||||
src = i.next()
|
src = next(i)
|
||||||
except Exception:
|
except Exception:
|
||||||
src = ''
|
src = ''
|
||||||
if device != interface_name:
|
if device != interface_name:
|
||||||
|
|
|
@ -29,7 +29,7 @@ class TackerBase(models.ModelBase):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
n = self._i.next().name
|
n = next(self._i).name
|
||||||
return n, getattr(self, n)
|
return n, getattr(self, n)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
Loading…
Reference in New Issue