You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 23, 2023. It is now read-only.
defrepeat(_time):
# close the decorator over time argumentdefdecorator(f):
# define the coroutineasyncdefg():
# call `f` every `time` secondswhileTrue:
t1=time.time()
f()
t2=time.time()
delta_t=t2-t1sleep_time=_time-delta_tif (sleep_time<0):
print("Warning: repeat@ sleep time < 0")
awaitasyncio.sleep(0)
else:
awaitasyncio.sleep(sleep_time)
# track the coroutine in a global list_loop_fns.append(g)
returndecorator