fix StopIteration behaviour in AsCompleted.batches
PEP 479: generators should `return` instead of `raise StopIteration`
@@ -2711,7 +2711,10 @@ class AsCompleted(object):
[6]
"""
while True:
+ try:
yield self.next_batch(block=True)
+ except StopIteration:
+ return
as_completed = AsCompleted
