Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`words`.`xish`.`utility`.`CallbackList``

class documentation

`class CallbackList: (source)`

View In Hierarchy

Container for callbacks.

Event queries are linked to lists of callables. When a matching event occurs, these callables are called in sequence. One-time callbacks are removed from the list after the first time the event was triggered.

Arguments to callbacks are split spread across two sets. The first set, callback specific, is passed to `addCallback` and is used for all subsequent event triggers. The second set is passed to `callback` and is event specific. Positional arguments in the second set come after the positional arguments of the first set. Keyword arguments in the second set override those in the first set.

Method | `__init__` | Undocumented
Method | `addCallback` | Add callback.
Method | `callback` | Call all registered callbacks.
Method | `isEmpty` | Return if list of registered callbacks is empty.
Method | `removeCallback` | Remove callback.
Instance Variable | `callbacks` | The registered callbacks as mapping from the callable to a tuple of a wrapper for that callable that keeps the callback specific arguments and a boolean that signifies if it is to be called only once.

def __init__(self): (source)

Undocumented

def addCallback(self, onetime, method, *args, **kwargs): (source)

Add callback.

The arguments passed are used as callback specific arguments.

Parameters
onetime:`bool` | If `True`, this callback is called at most once.
method | The callback callable to be added.
*args:`list` | Positional arguments to the callable.
**kwargs:`dict` | Keyword arguments to the callable.

def callback(self, *args, **kwargs): (source)

Call all registered callbacks.

The passed arguments are event specific and augment and override the callback specific arguments as described above.

Parameters
*args:`list` | Positional arguments to the callable.
**kwargs:`dict` | Keyword arguments to the callable.
Note
Exceptions raised by callbacks are trapped and logged. They will not propagate up to make sure other callbacks will still be called, and the event dispatching always succeeds.

def isEmpty(self): (source)

Return if list of registered callbacks is empty.

Returns
`bool` | Undocumented

def removeCallback(self, method): (source)

Remove callback.

Parameters
method | The callable to be removed.

callbacks: `dict` = (source)

The registered callbacks as mapping from the callable to a tuple of a wrapper for that callable that keeps the callback specific arguments and a boolean that signifies if it is to be called only once.