We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ea949a0 + 5846016 commit ba1bbb6Copy full SHA for ba1bbb6
sortinghat/core/jobs.py
@@ -468,7 +468,10 @@ def _iter_split(iterator, size=None):
468
# This code is based on Ashley Waite's answer to StackOverflow question
469
# "split a generator/iterable every n items in python (splitEvery)"
470
# (https://stackoverflow.com/a/44320132).
471
- while True:
472
- slice_iter = itertools.islice(iterator, size)
473
- peek = next(slice_iter)
474
- yield itertools.chain([peek], slice_iter)
+ try:
+ while True:
+ slice_iter = itertools.islice(iterator, size)
+ peek = next(slice_iter)
475
+ yield itertools.chain([peek], slice_iter)
476
+ except StopIteration:
477
+ return
0 commit comments