From d87f2ec37d31ddc30eee263b5f1a6423dc122267 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Wed, 7 Nov 2018 15:34:52 +0100 Subject: [PATCH] Fix issue #131 --- flatisfy/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flatisfy/tools.py b/flatisfy/tools.py index 75efade..8370247 100644 --- a/flatisfy/tools.py +++ b/flatisfy/tools.py @@ -169,7 +169,10 @@ def batch(iterable, size): sourceiter = iter(iterable) while True: batchiter = itertools.islice(sourceiter, size) - yield itertools.chain([next(batchiter)], batchiter) + try: + yield itertools.chain([next(batchiter)], batchiter) + except StopIteration: + return def is_within_interval(value, min_value=None, max_value=None):