gemd.entity.attribute.base_attribute module
- class gemd.entity.attribute.base_attribute.BaseAttribute(name: str, *, template: Optional[Union[AttributeTemplate, LinkByUID]] = None, origin: Union[Origin, str] = Origin.UNKNOWN, value: Optional[BaseValue] = None, notes: Optional[str] = None, file_links: Optional[Union[Iterable[FileLink], FileLink]] = None)
Bases:
DictSerializable
Base class for all attributes, which include property, condition, parameter, and metadata.
- Parameters
name (str) – Required name of the attribute. Each attribute within an object must have a unique name.
notes (str) – Optional free-form notes about the attribute.
value (BaseValue) – The value of the attribute.
template (AttributeTemplate) – Attribute template that defines the allowed bounds of this attribute. If a template and value are both present then the value must be within the template bounds.
origin (str or Origin) – The origin of the attribute. Must be one of “measured”, “predicted”, “summary”, “specified”, “computed”, or “unknown.” Default is “unknown.”
file_links (List[FileLink]) – Links to files associated with the attribute.
- typ
alias of
NotImplementedError
- 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
- skip = {}
- property template: Optional[Union[AttributeTemplate, LinkByUID]]
Get the template.