From 3fe3dfe6a173f026ad0ef2408d0c732a322af733 Mon Sep 17 00:00:00 2001 From: dharmendra Date: Thu, 17 Mar 2016 13:28:51 +0530 Subject: [PATCH] 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 --- tacker/agent/linux/ip_lib.py | 8 ++++---- tacker/db/model_base.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tacker/agent/linux/ip_lib.py b/tacker/agent/linux/ip_lib.py index 413f35366..faefb9adf 100644 --- a/tacker/agent/linux/ip_lib.py +++ b/tacker/agent/linux/ip_lib.py @@ -450,13 +450,13 @@ class IpRouteCommand(IpDeviceCommandBase): 'match', subnet).split('\n') for subnet_route_line in subnet_route_list_lines: i = iter(subnet_route_line.split()) - while(i.next() != 'dev'): + while(next(i) != 'dev'): pass - device = i.next() + device = next(i) try: - while(i.next() != 'src'): + while(next(i) != 'src'): pass - src = i.next() + src = next(i) except Exception: src = '' if device != interface_name: diff --git a/tacker/db/model_base.py b/tacker/db/model_base.py index 8fa0b191d..be9179a0c 100644 --- a/tacker/db/model_base.py +++ b/tacker/db/model_base.py @@ -29,7 +29,7 @@ class TackerBase(models.ModelBase): return self def next(self): - n = self._i.next().name + n = next(self._i).name return n, getattr(self, n) def __repr__(self):