Merge pull request #2022 from jrobeson/py3-compat-replace-iter.next

use next() instead of iter.next() throughout
This commit is contained in:
Markus Unterwaditzer 2016-05-27 23:12:18 +02:00
commit 7970681289
4 changed files with 9 additions and 9 deletions

View file

@ -609,8 +609,8 @@ class Results(object):
it = iter(self)
try:
for i in range(n):
it.next()
return it.next()
next(it)
return next(it)
except StopIteration:
raise IndexError(u'result index {0} out of range'.format(n))
@ -620,7 +620,7 @@ class Results(object):
"""
it = iter(self)
try:
return it.next()
return next(it)
except StopIteration:
return None

View file

@ -248,7 +248,7 @@ class FirstPipelineThread(PipelineThread):
# Get the value from the generator.
try:
msg = self.coro.next()
msg = next(self.coro)
except StopIteration:
break
@ -281,7 +281,7 @@ class MiddlePipelineThread(PipelineThread):
def run(self):
try:
# Prime the coroutine.
self.coro.next()
next(self.coro)
while True:
with self.abort_lock:
@ -326,7 +326,7 @@ class LastPipelineThread(PipelineThread):
def run(self):
# Prime the coroutine.
self.coro.next()
next(self.coro)
try:
while True:
@ -444,7 +444,7 @@ class Pipeline(object):
# "Prime" the coroutines.
for coro in coros[1:]:
coro.next()
next(coro)
# Begin the pipeline.
for out in coros[0]:

View file

@ -609,7 +609,7 @@ class ResultsIteratorTest(unittest.TestCase):
results = self.db._fetch(TestModel1)
it1 = iter(results)
it2 = iter(results)
it1.next()
next(it1)
list(it2)
self.assertEqual(len(list(it1)), 1)

View file

@ -133,7 +133,7 @@ class ExceptionTest(unittest.TestCase):
pl = pipeline.Pipeline((_produce(), _exc_work()))
pull = pl.pull()
for i in range(3):
pull.next()
next(pull)
self.assertRaises(TestException, pull.next)