MCPcopy Create free account
hub / github.com/bitcraze/crazyflie-lib-python / Caller

Class Caller

cflib/utils/callbacks.py:35–55  ·  view source on GitHub ↗

An object were callbacks can be registered and called

Source from the content-addressed store, hash-verified

33
34
35class Caller():
36 """ An object were callbacks can be registered and called """
37
38 def __init__(self):
39 """ Create the object """
40 self.callbacks = []
41
42 def add_callback(self, cb):
43 """ Register cb as a new callback. Will not register duplicates. """
44 if ((cb in self.callbacks) is False):
45 self.callbacks.append(cb)
46
47 def remove_callback(self, cb):
48 """ Un-register cb from the callbacks """
49 self.callbacks.remove(cb)
50
51 def call(self, *args):
52 """ Call the callbacks registered with the arguments args """
53 copy_of_callbacks = list(self.callbacks)
54 for cb in copy_of_callbacks:
55 cb(*args)

Callers 13

setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
add_update_callbackMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 4

setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72