MultiEventHook

class selene_sim.MultiEventHook(event_hooks: list[EventHook] | None = None, short_circuit: bool = True)

A class that encapsulates multiple EventHooks, allowing them to be treated as a single EventHook. When try_invoke is called, it will iterate through all the EventHooks, calling try_invoke on each one.

If short_circuit is set to True, the first EventHook that returns True will cause the MultiEventHook to return True, without calling any further EventHooks. If short_circuit is set to False, all EventHooks will be called, and the MultiEventHook will return True if any of the EventHooks return True.

If no EventHooks return True, the MultiEventHook will return False.

__abstractmethods__ = frozenset({})
__init__(event_hooks: list[EventHook] | None = None, short_circuit: bool = True)
add_event_hook(hook: EventHook)
event_hooks: list[EventHook]
get_selene_flags() list[str]

Define any arguments to the Selene executable that are required to enable the output of information pertinent to this EventHook.

For example, if Selene has a flag –provide-foo that enables emitting [(‘FOO:VALUE’, value)] events to the result stream, this method should return [’–provide-foo’].

on_new_shot() None

If this EventHook stores information on a shot-by-shot basis, implement this method to handle the creation of a new shot.

set_short_circuit(short_circuit: bool)
short_circuit: bool
try_invoke(tag: str, data: list) bool

Check the tag to see if it is relevant to this EventHook. If so, parse the data and return True.