salvus.project.components.entity_component
Functions
type_to_entity_string()
type_to_entity_string()def type_to_entity_string(_type: Type) -> str: ...Convert a type to the corresponding entity_type string as used in Salvus’
entity component.
Parameters
_typeType — The type to find corresponding entity string for. Allowed to be subtype of defined entity types.
Returns str — Entity type as string.
Classes
EntityComponent
EntityComponentclass EntityComponent(builtins.object):
def __init__(
self, project: salvus.project.project.Project, path: pathlib.Path
): ...Project subclass handling all things related to various configuration components which we’ll call entities.
Parameters
projectsalvus.project.project.Project — The project.pathpathlib.Path — The path where the entities are stored within the project.
Methods
add()
add()def add(self, entity: Any, overwrite: bool = False) -> None: ...Add an entity to the project.
Parameters
entityAny — The entity to add.overwritebool — Potentially overwrite an existing thing in project if it already exists.
Returns None
delete()
delete()def delete(self, entity_type: str, entity_name: str) -> None: ...Remove an entity from the project.
Parameters
entity_typestr — The type of entity to delete.entity_namestr — The name of the entity.
Returns None
get()
get()def get(self, entity_type: str, entity_name: str) -> Any: ...Get an entity.
Parameters
entity_typestr — The type of entity to get.entity_namestr — The name of the entity.
Returns Any
get_all()
get_all()def get_all(self, entity_type: str) -> Dict[str, Any]: ...Get all entities of a given type.
Parameters
entity_typestr — The type of entities to get.
Returns Dict[str, Any]
get_inverse_problem_configurations()
get_inverse_problem_configurations()def get_inverse_problem_configurations(
self, inversions: Optional[Sequence[str]] = None
) -> Dict[
str,
salvus.project.configuration.inverse_problem_configuration.InverseProblemConfiguration,
]: ...Get the inverse problem configuration objects for the passed inversions.
Parameters
inversionsOptional[Sequence[str]] — Inversions to return the objects for. Omitting this parameter returns all inversion problem configurations related to the project.
Returns Dict[str, salvus.project.configuration.inverse_problem_configuration.InverseProblemConfiguration] — A dictionary of inverse problem configurations.
has()
has()def has(self, entity_type: str, entity_name: str) -> bool: ...A check if an entity of a given type or name exists.
Parameters
entity_typestr — The type of entity to get.entity_namestr — The name of the entity.
Returns bool
list()
list()def list(self, entity_type: str) -> List[str]: ...List all available entities of the chosen type.
Parameters
entity_typestr — The type of the entities to list.
Returns List[str]