tethys.core.pipes.filters.filter_composite

Module Contents

class tethys.core.pipes.filters.filter_composite.CompositeFilter(*filters: FilterBase, function: Union[str, Callable] = '+')[source]

Bases: tethys.core.pipes.filters.filter_base.FilterBase

This filter aggregate scores from other filters and calculates a new score using a specific function.

Parameters
  • filters (FilterBase) – list of the filters

  • function (Union[str, Callable]) – function for calculating an aggregated score. Available aliases: [“+”, “*”, “max”, “min”]. Default value: “+”.

execute(self, data_packet: Any, **kwargs) → float[source]

Execute each filter and after execute the function with the typing.Generator (that contains the scores) argument.

Parameters

data_packet – any data object

Returns

calculated score (float)