gemd.entity.template.base_template module
Base template.
- class gemd.entity.template.base_template.BaseTemplate(name: str, *, description: Optional[str] = None, uids: Optional[Mapping[str, str]] = None, tags: Optional[Iterable[str]] = None)
Bases:
BaseEntity
Base class for all object templates.
- Parameters
name (str, required) – The name of the object template.
description (str, optional) – Long-form description of the object template.
uids (Map[str, str], optional) – A collection of unique IDs.
tags (List[str], optional) – Tags are hierarchical strings that store information about an entity. They can be used for filtering and discoverability.
- typ
alias of
NotImplementedError
- add_uid(scope: str, uid: str)
Add a uid.
- Parameters
scope (str) – scope of the uid
uid (str) – Unique identifier
- all_dependencies() Set[Union[BaseEntityType, LinkByUIDType]]
Return a set of all immediate dependencies (no recursion).
- as_dict() Dict[str, Any]
Convert the object to a dictionary.
- Returns
A dictionary representation of the object, where the keys are its fields.
- Return type
dict
- static build(d: Mapping[str, Any]) DictSerializableType
Build an object from a JSON dictionary.
This differs from from_dict in that the values themselves may also be dictionaries corresponding to serialized DictSerializable objects.
- Parameters
d (dict) – The object as a serialized dictionary.
- Returns
The deserialized object.
- Return type
- dump() Dict[str, Any]
Convert the object to a JSON dictionary, so that every entry is serialized.
Uses the json encoder client, so objects with uids are converted to LinkByUID dictionaries.
- Returns
A string representation of the object as a dictionary.
- Return type
str
- classmethod from_dict(d: Mapping[str, Any]) DictSerializableType
Reconstitute the object from a dictionary.
- Parameters
d (dict) – The object as a dictionary of key-value pairs that correspond to the object’s fields.
- Returns
The deserialized object.
- Return type
- to_link(scope: Optional[str] = None, *, allow_fallback: bool = False) LinkByUIDType
Generate a ~gemd.entity.link_by_uid.LinkByUID for this object.
- Parameters
scope (str, optional) – scope of the uid to get
allow_fallback (bool) – whether to grab another scope/id if chosen scope is missing (Default: False).
- Return type
- skip = {}