def _schedule_callbacks(self, resp): callbacks = resp._registered_callbacks if not callbacks: return loop = get_loop() for cb, is_async in callbacks: if is_async: loop.create_task(cb()) else: loop.run_in_executor(None, cb)
def _schedule_callbacks(self, resp): callbacks = resp._registered_callbacks if not callbacks: return loop = get_loop() for cb in callbacks: if iscoroutinefunction(cb): loop.create_task(cb()) else: loop.run_in_executor(None, cb)
def __init__(self, file): self._file = file self._loop = get_loop()