bobocep.cep.phenom.pattern.predicate.BoboPredicateCallType

class bobocep.cep.phenom.pattern.predicate.BoboPredicateCallType(call: Callable, dtype: type, subtype: bool = True, cast: bool = True)[source]

Bases: bobocep.cep.phenom.pattern.predicate.BoboPredicateCall

A predicate that evaluates using a custom function or method after first checking whether the event data is an instance of a given type. If it is not, then a cast to the type can be attempted and a copy of the event is passed with its data cast to the type.

Note: the copy is only used within the predicate callable. The original event remains in use elsewhere.

__init__(call: Callable, dtype: type, subtype: bool = True, cast: bool = True)[source]
Parameters
  • call – The callable to use for evaluating the predicate.

  • dtype – The data type to use for evaluation.

  • subtype – If True, the event’s data can be a subtype of the type specified in dtype. If False, it must be exactly the type in dtype.

  • cast – If True, and if the event’s data is not the expected type, then an attempt is made to cast it to dtype. If False, no attempt is made to cast the event’s data.

evaluate(event: bobocep.cep.event.event.BoboEvent, history: bobocep.cep.event.history.BoboHistory) bool[source]
Parameters
  • event – The event used for evaluation.

  • history – The history of currently accepted events.

Returns

True if predicate is satisfied; False otherwise.