MCPcopy Create free account
hub / github.com/EasyIME/PIME / sleep

Function sleep

python/python3/tornado/gen.py:657–675  ·  view source on GitHub ↗

Return a `.Future` that resolves after the given number of seconds. When used with ``yield`` in a coroutine, this is a non-blocking analogue to `time.sleep` (which should not be used in coroutines because it is blocking):: yield gen.sleep(0.5) Note that calling this functi

(duration: float)

Source from the content-addressed store, hash-verified

655
656
657def sleep(duration: float) -> "Future[None]":
658 """Return a `.Future` that resolves after the given number of seconds.
659
660 When used with ``yield`` in a coroutine, this is a non-blocking
661 analogue to `time.sleep` (which should not be used in coroutines
662 because it is blocking)::
663
664 yield gen.sleep(0.5)
665
666 Note that calling this function on its own does nothing; you must
667 wait on the `.Future` it returns (usually by yielding it).
668
669 .. versionadded:: 4.1
670 """
671 f = _create_future()
672 IOLoop.current().call_later(
673 duration, lambda: future_set_result_unless_cancelled(f, None)
674 )
675 return f
676
677
678class _NullFuture(object):

Callers

nothing calls this directly

Calls 4

_create_futureFunction · 0.85
call_laterMethod · 0.80
currentMethod · 0.80

Tested by

no test coverage detected