Skip to content

Commit fbbe916

Browse files
committed
Properly zip cases where zip(*logs) is empty
1 parent 717747a commit fbbe916

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

util/analyze/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ def zipped_keep_blocks_if(*logs, pred):
5555
except TypeError:
5656
old_pred = pred
5757
pred = lambda *blks: all(old_pred(b) for b in blks)
58+
except StopIteration:
59+
# There was nothing in zip(*logs)...
60+
old_pred = pred
61+
def new_pred(*blks):
62+
try:
63+
return old_pred(*blks)
64+
except TypeError:
65+
return all(old_pred(b) for b in blks)
66+
pred = new_pred
5867

5968
def zip_benchmarks_if(*benchmarks):
6069
# (A[a], A[a]) -> [(a, a)] or []

0 commit comments

Comments
 (0)