Skip to content

Commit ee9a627

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f3f4ed6 commit ee9a627

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/executorlib/standalone/batched.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from concurrent.futures import Future
22

33

4-
def batched_futures(lst: list[Future], nested_skip_lst: list[list], n: int) -> list[list]:
4+
def batched_futures(
5+
lst: list[Future], nested_skip_lst: list[list], n: int
6+
) -> list[list]:
57
"""
68
Batch n completed future objects. If the number of completed futures is smaller than n and the end of the batch is
79
not reached yet, then an empty list is returned. If n future objects are done, which are not included in the skip_set
@@ -15,11 +17,7 @@ def batched_futures(lst: list[Future], nested_skip_lst: list[list], n: int) -> l
1517
Returns:
1618
list: results of the batched futures
1719
"""
18-
skip_set = {
19-
id(item)
20-
for f in nested_skip_lst
21-
for item in f.result()
22-
}
20+
skip_set = {id(item) for f in nested_skip_lst for item in f.result()}
2321

2422
done_lst = []
2523
n_expected = min(n, len(lst) - len(skip_set))

0 commit comments

Comments
 (0)