bobocep.cep.event.history.BoboHistory

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

Bases: BoboJSONable

An event history.

__init__(events: Dict[str, List[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[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[BoboEvent]]
Returns:

All history events, indexed by group.

first() BoboEvent | None[source]
Returns:

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

static from_json_dict(d: dict) BoboHistory[source]
Parameters:

d – A JSON dict representation of the history.

Returns:

A new instance of the history.

static from_json_str(j: str) BoboHistory[source]
Parameters:

j – A JSON str representation of the history.

Returns:

A new instance of the history.

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

group – A group name.

Returns:

The BoboEvent instances associated with group.

last() BoboEvent | None[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.