MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / py_sleep

Function py_sleep

tests/python/test_event_loop.py:330–334  ·  view source on GitHub ↗
(seconds)

Source from the content-addressed store, hash-verified

328 js_sleep = pm.eval("(seconds) => new Promise((resolve) => setTimeout(resolve, seconds*1000))")
329
330 def py_sleep(seconds): # asyncio.sleep has issues on Python 3.8
331 loop = asyncio.get_running_loop()
332 future = loop.create_future()
333 loop.call_later(seconds, lambda: future.set_result(None))
334 return future
335 both_sleep = pm.eval("""
336 (js_sleep, py_sleep) => async (seconds) => {
337 await js_sleep(seconds);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected