def rawlink(self, callback): """Register a callable to be executed when the greenlet finishes the execution. WARNING: the callable will be called in the HUB greenlet. """ if not callable(callback): raise TypeError('Expected callable: %r' % (callback, )) self._links.append(callback) if self.ready() and not self._notifier.active: self._notifier.start(self._notify_links)
def __init__(self, callback): if not callable(callback): raise TypeError("Expected callable: %r" % (callback, )) self.callback = callback