| 746 | """ |
| 747 | |
| 748 | def __init__( |
| 749 | self, |
| 750 | ctx_run: Callable, |
| 751 | gen: "Generator[_Yieldable, Any, _T]", |
| 752 | result_future: "Future[_T]", |
| 753 | first_yielded: _Yieldable, |
| 754 | ) -> None: |
| 755 | self.ctx_run = ctx_run |
| 756 | self.gen = gen |
| 757 | self.result_future = result_future |
| 758 | self.future = _null_future # type: Union[None, Future] |
| 759 | self.running = False |
| 760 | self.finished = False |
| 761 | self.io_loop = IOLoop.current() |
| 762 | if self.ctx_run(self.handle_yield, first_yielded): |
| 763 | gen = result_future = first_yielded = None # type: ignore |
| 764 | self.ctx_run(self.run) |
| 765 | |
| 766 | def run(self) -> None: |
| 767 | """Starts or resumes the generator, running until it reaches a |