()
| 651 | # Yield must be hidden in closure so that the futures are submitted |
| 652 | # before the first iterator value is required. |
| 653 | def result_iterator(): |
| 654 | try: |
| 655 | # reverse to keep finishing order |
| 656 | fs.reverse() |
| 657 | while fs: |
| 658 | if ( |
| 659 | buffersize |
| 660 | and (executor := executor_weakref()) |
| 661 | and (args := next(zipped_iterables, None)) |
| 662 | ): |
| 663 | fs.appendleft(executor.submit(fn, *args)) |
| 664 | # Careful not to keep a reference to the popped future |
| 665 | if timeout is None: |
| 666 | yield _result_or_cancel(fs.pop()) |
| 667 | else: |
| 668 | yield _result_or_cancel(fs.pop(), end_time - time.monotonic()) |
| 669 | finally: |
| 670 | for future in fs: |
| 671 | future.cancel() |
| 672 | return result_iterator() |
| 673 | |
| 674 | def shutdown(self, wait=True, *, cancel_futures=False): |
nothing calls this directly
no test coverage detected