Skip to content

Commit 5199911

Browse files
committed
Properly zip cases where zip(*logs) is empty
1 parent 8d305a8 commit 5199911

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
@@ -74,6 +74,15 @@ def zipped_keep_blocks_if(*logs, pred):
7474
except TypeError:
7575
old_pred = pred
7676
pred = lambda *blks: all(old_pred(b) for b in blks)
77+
except StopIteration:
78+
# There was nothing in zip(*logs)...
79+
old_pred = pred
80+
def new_pred(*blks):
81+
try:
82+
return old_pred(*blks)
83+
except TypeError:
84+
return all(old_pred(b) for b in blks)
85+
pred = new_pred
7786

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

0 commit comments

Comments
 (0)