priops.callable

priops.CallableEdge

class priops.callable.CallableEdge(callable, input_node, output_node, weight=None, name=None, select=None, dispatch=None)[source]

Bases: priops.edge.Edge

Calls some callable on call time.

__init__(callable, input_node, output_node, weight=None, name=None, select=None, dispatch=None)[source]

callable is the callable to call on call time.

select determines in what order the arguments handed over to self.process() are handed over to the callable. If select is not given, the default is to hand over all arguments.

dispatch is False per default for scalar input node, and True per default for non-scalar input node. If false, the argument handed over to self.process() will be directly given to the callable as the first positional argument. If dispatch is true, several arguments to self.process() will be split to several positional arguments to callable by callable(*data).

Note that both select as well as dispatch are not available in case the input node is scalar. If either select of dispatch are given with a scalar input node, ValueError is raised.

input_node, output_node, weight and name go to Edge.

process(input)[source]

Calls self.callable with the arguments given to this method.

If self.select is not None, the argument tuple for self.callable is constructed from the input list using the self.select tuple handed over to __init__() as follows:

[input[sel] for sel in select]

Thus the i-th element of select tells what element from the input tuple to use at argument i of self.callable().

If self.select is unspecified (None), the behaviour is to hand over all arguments.

If self.dispatch is true, the argument tuple obtained is handed over using *data syntax, else it is handed over as the first positional argument.

Table Of Contents

Previous topic

priops.pathfinder

Next topic

priops.classes

This Page