lenskit.pipeline.ComponentInputHook#

class lenskit.pipeline.ComponentInputHook#

Bases: Protocol

Inspect or process data as it passes to a component’s input.

As with all Pipeline Hooks, an input hook is a callable that is run at the appropriate stage of the input.

Component input hooks are installed under the name component-input.

Stability:

Experimental

__call__(node, input, value, **context)#

Inspect or process the component input data.

Parameters:
  • node (lenskit.pipeline.nodes.ComponentInstanceNode[Any]) – The component node being invoked.

  • input_name – The name of the component’s input that will receive the data.

  • input_type – The type of data the component expects for this input, if one was specified in the component definition.

  • value (object) – The data value to be supplied. This is declared object, because its type is not known or guaranteed in the genral case.

  • context (Any) – Additional context variables, mostly for the use of internal hooks.

  • input (lenskit.pipeline.components.ComponentInput)

Returns:

The value to pass to the component. For inspection-only hooks, this will just be value; hooks can also substitute alternative values depending on application needs.

Return type:

Any