Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.components.event_component

Classes

EventComponent

class EventComponent(builtins.object):
    def __init__(self, project: Project, path: pathlib.Path):
        ...

Project subclass handling all things related to the events.

Parameters
  • project Project — The project for the component.
  • path pathlib.Path — The event path in the project.
Methods
add()
def add(
    self,
    e: Union[
        salvus.flow.collections.event.Event,
        salvus.flow.collections.event_collection.EventCollection,
        str,
        pathlib.Path,
        salvus.flow.collections.event_block.EventBlockCollection,
    ],
    check_consistency_with_domain: bool = True,
) -> None:
    ...

Adds an event or event collection object to the project.

Might not be supported for all event backends and not every backend can add all types of event representations.

Parameters
  • e Union[salvus.flow.collections.event.Event, salvus.flow.collections.event_collection.EventCollection, str, pathlib.Path, salvus.flow.collections.event_block.EventBlockCollection] — Event, EventCollection, or an event block representation to be added.
  • check_consistency_with_domain bool — Ensure that the entity is compatible with the simulation domain.
Returns None
delete()
def delete(self, event_name: str) -> None:
    ...

Delete an event.

Might not be supported for all backends.

Fully delete all data and what not from the chosen event. Be careful as there is no other prompt and calling this function will irrevocably delete all data for the chosen event.

Parameters
  • event_name str — Name of the event to be deleted.
Returns None
exists()
def exists(self, event_name: str) -> bool:
    ...

Determine if the specified event exists within the project.

Parameters
  • event_name str — The name of the event.
Returns boolTrue or False.
get()
def get(self, event_name: str) -> salvus.flow.collections.event.Event:
    ...

Get an event.

Parameters
  • event_name str — Name of the event.
Returns salvus.flow.collections.event.Event
get_all()
def get_all(self) -> salvus.flow.collections.event_collection.EventCollection:
    ...

Get all events.

Returns salvus.flow.collections.event_collection.EventCollection
list()
def list(self) -> List[str]:
    ...

Get a list of all events.

Returns List[str]
update()
def update(self, e: salvus.flow.collections.event.Event) -> None:
    ...

Special function updating a single event.

This is different deleting and re-adding an event in that all associated data will be retained. Please be aware of of the consequences and that it is not always advisable to change existing data in a project.

Parameters
  • e salvus.flow.collections.event.Event — Event to be updated.
Returns None