MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / sleep

Function sleep

tools/python-3.11.9-amd64/Lib/asyncio/tasks.py:637–651  ·  view source on GitHub ↗

Coroutine that completes after a given time (in seconds).

(delay, result=None)

Source from the content-addressed store, hash-verified

635
636
637async def sleep(delay, result=None):
638 """Coroutine that completes after a given time (in seconds)."""
639 if delay <= 0:
640 await __sleep0()
641 return result
642
643 loop = events.get_running_loop()
644 future = loop.create_future()
645 h = loop.call_later(delay,
646 futures._set_result_unless_cancelled,
647 future, result)
648 try:
649 return await future
650 finally:
651 h.cancel()
652
653
654def ensure_future(coro_or_future, *, loop=None):

Callers 7

drainMethod · 0.70
mainFunction · 0.50
demoFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 4

__sleep0Function · 0.85
create_futureMethod · 0.45
call_laterMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected