boing.nodes — The nodes of the pipeline¶The module boing.nodes contains a set of generic utility nodes.
boing.nodes.DataReader(inputdevice, postend=True, parent=None)¶Producer node that anytime the
device inputdevice send the signal readyRead it reads the
device and it produces a message containing the data. The provided
products is a dictionary {"str": data} if data is a string,
otherwise the product will be a dictionary like {"data": data}.
If the argument postend is set to True, the
DataReader will never produce an empty product, like
{"str": ""} or {"data": b""}. parent defines the parent
of the node.
inputDevice()¶Return the considered input device.
boing.nodes.DataWriter(outputdevice, writeend=True, hz=None, parent=None)¶Consumer node that anytime it
receives some data, it writes the data to the device outputdevice. The
DataWriter requires the products str if the output
device is text enabled (see method isTextModeEnabled) otherwise it
requires the product data. If the argument writeend is set to
True, the DataWriter will never write an empty string;
this can be useful in order to prevent a socket to close. parent
defines the parent of the node.
outputDevice()¶Return the considered output device.
boing.nodes.Dump(request=Request.ANY, mode='items', separator='\n\n', src=False, dest=False, depth=None, parent=None)¶Instances of the Dump class produce a string
representation of the products they receive. The string is
obtained using the function boing.utils.deepDump().
The parameter request must be an instance of the class
boing.core.Request and it is used to select the product
to be dumped. The default value for request is
Request.ALL. mode defines how the received
products will be dumped. The available values are:
'keys', only the matched keys are written;'values', only the values of the matched keys are written;'items', both the keys and values are written.separator defines the string to be written between two
products. The default value for separator is '\n\n'. src
defines whether the node also dumps the producer of the received
products. The default for src is False. The paramenter dest
defines whether the node adds a reference to itself when it dumps
the received products; its default value is False. The parameter
depth defines how many levels of the data hierarchy are explored
and it is directly passed to the boing.utils.deepDump()
function.
mode()¶Return the node’s mode.
setMode(mode)¶Set the node’s dump mode.
boing.nodes.Editor(dict, blender, parent=None)¶Instances of the Editor class apply to the received
products the (key, values) pairs of dict.
blender defines the output of the node (see
boing.core.Functor). parent must be a
PyQt4.QtCore.QObject and it defines the node’s parent.
get(key, default=None)¶Return the value for key if key is in the editor’s dictionary, else default. If default is not given, it defaults to None.
set(key, value)¶Set the value for key to value.
items()¶Return a new view of the editor dictionary’s items ((key, value) pairs).
boing.nodes.DiffArgumentFunctor(functorfactory, request, blender=Functor.MERGECOPY, parent=None)¶It takes a functorfactory and for each different argument path, it creates a new functor which is applied to the argument value. The args must be a diff-based path so that functor can be removed depending on ‘diff.removed’ instances.
boing.nodes.Timekeeper(blender=Functor.MERGECOPY, parent=None)¶Instances of the Timekeeper class tag each received
product with the timestamp when the product is received; then they
forward the product.
blender defines the output of the node (see
boing.core.Functor). parent must be a
PyQt4.QtCore.QObject and it defines the node’s parent.