MCPcopy
hub / github.com/alievk/avatarify-python / Once

Class Once

afy/utils.py:49–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49class Once():
50 _id = {}
51
52 def __init__(self, what, who=log, per=1e12):
53 """ Do who(what) once per seconds.
54 what: args for who
55 who: callable
56 per: frequency in seconds.
57 """
58 assert callable(who)
59 now = time.time()
60 if what not in Once._id or now - Once._id[what] > per:
61 who(what)
62 Once._id[what] = now
63
64
65class TicToc:

Callers 6

_send_recv_asyncMethod · 0.90
send_workerMethod · 0.90
recv_workerMethod · 0.90
recv_workerMethod · 0.90
predictor_workerMethod · 0.90
send_workerMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected