Wrap

Wrap class. Used to wrap tasks defined in pype processing lines.

class spype.core.wrap.Wrap(task, **kwargs)[source]

Class to encapsulate a task.

agg(scope='object')[source]

Mark wrap as aggregating output from input tasks.

This will store all outputs of previous task in a list then feed to this task when it is done.

Return type:Wrap
compatible(other, extra_params=None)[source]

Return True if self (current wrap) provides valid inputs for other.

Parameters:
  • other (Union[Task, Wrap]) – Another task or wrap
  • extra_params (Optional[Mapping[~KT, +VT_co]]) – A mapping of extra parameters
Returns:

Return type:

bool

conditional_name

return the name of the predicate, else None

fan()[source]

Mark Wrap as fanning out.

This will cause it to iterate output and queue one item at a time.

Return type:Wrap
fit(*args)[source]

Method to adapt order/name of the outputs.

This is useful if the output order/name needs to be adjusted to work with the next Wrap in the Pype.

Parameters:args – A sequence of ints/strings for mapping output into args and kwargs
Returns:
Return type:Wrap instance
iff(predicate=None)[source]

Register a condition that must be true for data to continue in pype.

Parameters:predicate (Union[Callable[…, bool], Sequence[Callable[…, bool]], None]) – A function that takes the same inputs as the task and returns a boolean.
Returns:
Return type:Wrap
par(**kwargs)

Set values for paramters.

If this task does not receive all the required arguments the ones set with this function will be used.

Return type:Wrap
partial(**kwargs)[source]

Set values for paramters.

If this task does not receive all the required arguments the ones set with this function will be used.

Return type:Wrap
signature

return signature which indicates the arguments expected as input, excluding partials

Return type:Signature
task_name

return the short name of the wrapped task