Lines Matching defs:loop
97 def run_briefly(loop):
101 t = loop.create_task(gen)
103 # It occurs if the loop is stopped or if a task raises a BaseException.
106 loop.run_until_complete(t)
111 def run_until(loop, pred, timeout=support.SHORT_TIMEOUT):
118 loop.run_until_complete(tasks.sleep(0.001))
121 def run_once(loop):
122 """Legacy API to run once through the event loop.
128 loop.call_soon(loop.stop)
129 loop.run_forever()
179 def loop(environ):
190 if environ['PATH_INFO'] == '/loop':
191 return loop(environ)
344 on next loop iteration after all ready handlers done
355 Value passed to yield is time advance to move loop's time forward.
538 def close_loop(loop):
539 if loop._default_executor is not None:
540 if not loop.is_closed():
541 loop.run_until_complete(loop.shutdown_default_executor())
543 loop._default_executor.shutdown(wait=True)
544 loop.close()
558 def set_event_loop(self, loop, *, cleanup=True):
559 if loop is None:
560 raise AssertionError('loop is None')
561 # ensure that the event loop is passed explicitly in asyncio
564 self.addCleanup(self.close_loop, loop)
567 loop = TestLoop(gen)
568 self.set_event_loop(loop)
569 return loop