MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / once

Method once

src/util/Event.py:15–25  ·  view source on GitHub ↗
(self, func, name=None)

Source from the content-addressed store, hash-verified

13 return "Event(%s)" % list.__repr__(self)
14
15 def once(self, func, name=None):
16 func.once = True
17 func.name = None
18 if name: # Dont function with same name twice
19 names = [f.name for f in self if "once" in dir(f)]
20 if name not in names:
21 func.name = name
22 self.append(func)
23 else:
24 self.append(func)
25 return self
26
27
28if __name__ == "__main__":

Callers 10

testBenchmarkFunction · 0.95
testUsageFunction · 0.95
siteDownloadMethod · 0.80
downloadContentMethod · 0.80
downloadMethod · 0.80
actionUpdateMethod · 0.80
testEventMethod · 0.80
testOnceMethod · 0.80
testOnceMultipleMethod · 0.80
testOnceNamedMethod · 0.80

Calls

no outgoing calls

Tested by 4

testEventMethod · 0.64
testOnceMethod · 0.64
testOnceMultipleMethod · 0.64
testOnceNamedMethod · 0.64