Callback

Defined in module: wield.declarative.callbacks.callbacks.Callback

class Callback(initialcall=None, doc=None)[source][github]

Bases: object

Callable object dispatching its call to registered callbacks

Parameters:
  • initialcall – First call for the in the sequence, also provides docstring

  • doc – (optional) can override the docstring for this object.

This object provides functions transparently as extendable callback hooks.

__init__(initialcall=None, doc=None)[source][github]

Methods

__init__([initialcall, doc])

register([key, callback, remove, throw])

Register a function into the callback

Attributes

initialcall[github]
callbacks[github]
register(key=None, callback=None, remove=False, throw=False)[source][github]

Register a function into the callback

Parameters:
  • key (hashable) – registration key for callback

  • callback – function to be called

Raises:

KeyError if callback key is already present (keys must be unique)