How to use 'sleep python' in Python

Every line of 'sleep python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
27def sleep(*args):
28 """ Args for backwards compatibility
29 """
30 if skip_sleep:
31 return
32 time.sleep(1)
21def sleep(t, safe=True):
22 """
23 pause operations
24
25 Unlike standard time.sleep(...), breaks pause when controller shutdown
26 event is received.
27
28 Args:
29 t: number of seconds to sleep
30
31 Optional:
32 safe: break on shutdown event (default is True)
33
34 Returns:
35 True if sleep is finished, False if shutdown event is received
36 """
37 if safe:
38 time_start = time()
39 time_end = time_start + t
40 while time() < time_end:
41 if is_shutdown():
42 return False
43 _sleep(_polldelay)
44 return True
45 else:
46 _sleep(t)
47 return True

Related snippets