Move more xrange to six

plus a bonus next()

Signed-off-by: Adrian Tschira <nota@notafile.com>
This commit is contained in:
Adrian Tschira 2018-04-28 13:57:00 +02:00
parent 9558236728
commit d82b6ea9e6
9 changed files with 28 additions and 11 deletions

View file

@ -27,6 +27,8 @@ from contextlib import contextmanager
import logging
from six.moves import range
logger = logging.getLogger(__name__)
@ -158,13 +160,13 @@ def concurrently_execute(func, args, limit):
def _concurrently_execute_inner():
try:
while True:
yield func(it.next())
yield func(next(it))
except StopIteration:
pass
return logcontext.make_deferred_yieldable(defer.gatherResults([
preserve_fn(_concurrently_execute_inner)()
for _ in xrange(limit)
for _ in range(limit)
], consumeErrors=True)).addErrback(unwrapFirstError)