bobocep.cep.event.history.BoboHistory

class bobocep.cep.event.history.BoboHistory(events: Dict[str, List[bobocep.cep.event.event.BoboEvent]])[source]

Bases: bobocep.bobocep.BoboJSONable

An event history.

__init__(events: Dict[str, List[bobocep.cep.event.event.BoboEvent]])[source]
Parameters

events – The history of events. Keys are group names. Values are lists of BoboEvent instances associated with a group.

all_events() Tuple[bobocep.cep.event.event.BoboEvent, ...][source]
Returns

All history events in a tuple.

all_groups() Tuple[str, ...][source]
Returns

All history groups in a tuple.

property events: Dict[str, List[bobocep.cep.event.event.BoboEvent]]
Returns

All history events, indexed by group.

first() Optional[bobocep.cep.event.event.BoboEvent][source]
Returns

The BoboEvent with the oldest timestamp, if there is at least one BoboEvent in the history.

static from_json_dict(d: dict) bobocep.cep.event.history.BoboHistory[source]
Parameters

d – A JSON dict representation of the history.

Returns

A new instance of the history.

static from_json_str(j: str) bobocep.cep.event.history.BoboHistory[source]
Parameters

j – A JSON str representation of the history.

Returns

A new instance of the history.

group(group: str) Tuple[bobocep.cep.event.event.BoboEvent, ...][source]
Parameters

group – A group name.

Returns

The BoboEvent instances associated with group.

last() Optional[bobocep.cep.event.event.BoboEvent][source]
Returns

The BoboEvent with the most recent timestamp, if there is at least one BoboEvent in the history.

size() int[source]
Returns

The total number of history events across all groups.

to_json_dict() dict[source]
Returns

A JSON dict representation of the history.

to_json_str() str[source]
Returns

A JSON str representation of the history.