Subscriber

class maze.core.events.pubsub.Subscriber

Event aggregation object.

abstract get_interfaces() → List[Type[abc.ABC]]

Specification of the event interfaces this subscriber wants to receive events from. Every subscriber must implement this configuration method.

Returns

A list of interface classes

notify_event(event: maze.core.events.event_record.EventRecord)

Notify the subscriber of a new event occurrence.

Parameters

event – the event

Returns

None

query_events(event_spec: Union[Callable, Iterable[Callable]]) → Iterable

Return all events collected at the current env step matching one or more given event types. The event types are specified by the interface member function object itself.

Event calls are recorded as EventRecord, an object providing access to the passed arguments of the event method.

Parameters

event_spec – Specifies the event type by the interface member function. Can either be a single event type specification or a list of specifications.

Returns

An iterable to the event objects.

reset()

Reset event aggregation.

Returns

None