This commit is contained in:
Lucas Verney 2018-11-07 15:34:52 +01:00
parent 4ef32a5653
commit d87f2ec37d

View File

@ -169,7 +169,10 @@ def batch(iterable, size):
sourceiter = iter(iterable) sourceiter = iter(iterable)
while True: while True:
batchiter = itertools.islice(sourceiter, size) batchiter = itertools.islice(sourceiter, size)
try:
yield itertools.chain([next(batchiter)], batchiter) yield itertools.chain([next(batchiter)], batchiter)
except StopIteration:
return
def is_within_interval(value, min_value=None, max_value=None): def is_within_interval(value, min_value=None, max_value=None):