MCPcopy
hub / github.com/sartography/SpiffWorkflow / connect

Method connect

SpiffWorkflow/util/event.py:65–88  ·  view source on GitHub ↗

Connects the event with the given callback. When the signal is emitted, the callback is invoked. .. note:: The signal handler is stored with a hard reference, so you need to make sure to call :class:`disconnect()` if you want the handler

(self, callback, *args, **kwargs)

Source from the content-addressed store, hash-verified

63 return self.emit(*args, **kwargs)
64
65 def connect(self, callback, *args, **kwargs):
66 """
67 Connects the event with the given callback.
68 When the signal is emitted, the callback is invoked.
69
70 .. note::
71
72 The signal handler is stored with a hard reference, so you
73 need to make sure to call :class:`disconnect()` if you want the
74 handler
75 to be garbage collected.
76
77 :type callback: object
78 :param callback: The callback function.
79 :type args: tuple
80 :param args: Optional arguments passed to the callback.
81 :type kwargs: dict
82 :param kwargs: Optional keyword arguments passed to the callback.
83 """
84 if self.is_connected(callback):
85 raise AttributeError('callback is already connected')
86 if self.hard_subscribers is None:
87 self.hard_subscribers = []
88 self.hard_subscribers.append((callback, args, kwargs))
89
90 def listen(self, callback, *args, **kwargs):
91 """

Callers 15

_add_boundary_eventMethod · 0.45
connect_outgoingMethod · 0.45
_parseMethod · 0.45
get_collaborationMethod · 0.45
create_taskMethod · 0.45
create_taskMethod · 0.45
connect_outgoingMethod · 0.45
from_dictMethod · 0.45
connect_outgoing_ifMethod · 0.45
__init__Method · 0.45

Calls 1

is_connectedMethod · 0.95

Tested by 10

__init__Method · 0.36
testValidateMethod · 0.36
testConnectMethod · 0.36
testTestMethod · 0.36
testAncestorsMethod · 0.36
test_ancestors_cyclicMethod · 0.36
testPatternMethod · 0.36
testPatternMethod · 0.36
track_taskFunction · 0.36