loki.batch.pipeline

Classes

Pipeline(*args[, classes])

A transformation pipeline that combines multiple Transformation passes and allows to apply them in unison.

class Pipeline(*args, classes=None, **kwargs)

Bases: object

A transformation pipeline that combines multiple Transformation passes and allows to apply them in unison.

The associated Transformation objects are constructed from keyword arguments in the constructor, so shared keywords get same initial value.

transformations

The list of transformations applied to a source in this pipeline

Type:

list of Transformation

Parameters:
  • classes (tuple of types) – A tuple of types from which to instantiate Transformation objects.

  • *args (optional) – Positional arguments that are passed on to the constructors of all transformations

  • **kwargs (optional) – Keyword arguments that are matched to the constructor signature of the transformations.

prepend(transformation)

Prepend a fully instantiated Transformation object to this pipeline.

Parameters:

transformation (Transformation) – Transformation object to prepend

append(transformation)

Append a fully instantiated Transformation object to this pipeline.

Parameters:

transformation (Transformation) – Transformation object to append

extend(pipeline)

Append all :any`Transformation` objects of a given Pipeline

Parameters:

pipeline (Pipeline) – Pipeline whose transformations will be appended

apply(source, **kwargs)

Apply each associated Transformation to source

It dispatches to the respective apply() of each Transformation in the order specified in the constructor.

Parameters:
  • source (Sourcefile or Module or Subroutine) – The source item to transform.

  • **kwargs (optional) – Keyword arguments that are passed on to the methods defining the actual transformation.