def run(self):
        """ Runs generator and executes tasks
        """
        gen = self.gen
        try:
            task = next(gen)  # start generator and receive first task
        except StopIteration:
            return
        while True:
            try:
                if isinstance(task, (list, tuple)):
                    assert len(task), "Empty tasks sequence"
                    first_task = task[0]
                    if isinstance(first_task, ProcessTask):
                        task = MultiProcessTask(task)
                    elif GTask and isinstance(first_task, GTask):
                        task = MultiGTask(task)
                    else:
                        task = MultiTask(task)

                with task.executor_class(task.max_workers) as executor:
                    if isinstance(task, MultiTask):
                        task = self._execute_multi_task(gen, executor, task)
                    else:
                        task = self._execute_single_task(gen, executor, task)
            except __HOLE__:
                break
            except ReturnResult as e:
                gen.close()
                return e.result
dataset/ETHPy150Open reclosedev/async_gui/async_gui/engine.py/Runner.run