openmnglab.model.functions.interface.IFunction#

class openmnglab.model.functions.interface.IFunction[source]#

Bases: ABC

A concrete instance of a function to compute something. Function to operate on must be set using set_input() before executing the function with execute().

Implementation details#

  • set_input() should not validate the data, but only store it internally so subsequent calls to execute() or validate_input() can access it.

  • Implementations should assume that they have an exclusive copy of the data to work on and should not copy input data defensively

  • Implementations may perform additional validations for the data in validate_input() for debugging purposes, but there is no guarantee that the method is called by the integration layer.

__init__()#

Methods

__init__()

execute()

Execute the function based on the data set by set_input()

set_input(*data_in)

Sets the input data for this function

validate_input()

abstract execute() Iterable[IDataContainer] | None[source]#

Execute the function based on the data set by set_input()

Returns:

The data containers produced by executing the function

abstract set_input(*data_in: IDataContainer)[source]#

Sets the input data for this function

Parameters:

data_in – The input data