class AttributeByTemplateAndObjectTemplate( Serializable['AttributeByTemplateAndObjectTemplate'], Variable): """[ALPHA] Attribute marked by an attribute template and an object template. For example, one property may be measured by two different measurement techniques. In this case, that property would have the same attribute template. Filtering by measurement templates, which identify the measurement techniques, disambiguates the technique used to measure that otherwise ambiguous property. Parameters --------- name: str a short human-readable name to use when referencing the variable headers: list[str] sequence of column headers attribute_template: LinkByUID attribute template that identifies the attribute to assign to the variable object_template: LinkByUID template that identifies the associated object attribute_constraints: list[(LinkByUID, Bounds)] constraints on object attributes in the target object that must be satisfied. Constraints are expressed as Bounds. Attributes are expressed with links. The attribute that the variable is being set to may be the target of a constraint as well. type_selector: DataObjectTypeSelector strategy for selecting data object types to consider when matching, defaults to PREFER_RUN """ name = properties.String('name') headers = properties.List(properties.String, 'headers') attribute_template = properties.Object(LinkByUID, 'attribute_template') object_template = properties.Object(LinkByUID, 'object_template') attribute_constraints = properties.Optional( properties.List( properties.SpecifiedMixedList( [properties.Object(LinkByUID), properties.Object(BaseBounds)] ) ), 'attribute_constraints') type_selector = properties.Enumeration(DataObjectTypeSelector, "type_selector") typ = properties.String('type', default="attribute_by_object", deserializable=False) def _attrs(self) -> List[str]: return ["name", "headers", "attribute_template", "object_template", "attribute_constraints", "type_selector", "typ"] def __init__(self, *, name: str, headers: List[str], attribute_template: LinkByUID, object_template: LinkByUID, attribute_constraints: List[List[Union[LinkByUID, BaseBounds]]] = None, type_selector: DataObjectTypeSelector = DataObjectTypeSelector.PREFER_RUN): self.name = name self.headers = headers self.attribute_template = attribute_template self.object_template = object_template self.attribute_constraints = attribute_constraints self.type_selector = type_selector
class DummyDescriptor(object): dummy_map = properties.Mapping(properties.Float(), properties.String) dummy_list = properties.List(properties.Float, properties.String) dummy_set = properties.Set(type(properties.Float())) link_or_else = properties.LinkOrElse() map_collection_key = properties.Mapping( properties.Optional(properties.String), properties.Integer) specified_mixed_list = properties.SpecifiedMixedList( [properties.Integer(default=100)])
class AttributeByTemplate(Serializable['AttributeByTemplate'], Variable): """[ALPHA] Attribute marked by an attribute template. Parameters ---------- name: str a short human-readable name to use when referencing the variable headers: list[str] sequence of column headers template: LinkByUID attribute template that identifies the attribute to assign to the variable attribute_constraints: list[list[LinkByUID, Bounds]] constraints on object attributes in the target object that must be satisfied. Constraints are expressed as Bounds. Attributes are expressed with links. The attribute that the variable is being set to may be the target of a constraint as well. type_selector: DataObjectTypeSelector strategy for selecting data object types to consider when matching, defaults to PREFER_RUN """ name = properties.String('name') headers = properties.List(properties.String, 'headers') template = properties.Object(LinkByUID, 'template') attribute_constraints = properties.Optional( properties.List( properties.SpecifiedMixedList( [properties.Object(LinkByUID), properties.Object(BaseBounds)])), 'attribute_constraints') type_selector = properties.Enumeration(DataObjectTypeSelector, "type_selector") typ = properties.String('type', default="attribute_by_template", deserializable=False) def _attrs(self) -> List[str]: return [ "name", "headers", "template", "attribute_constraints", "type_selector", "typ" ] def __init__( self, *, name: str, headers: List[str], template: LinkByUID, attribute_constraints: Optional[List[List[Union[LinkByUID, BaseBounds]]]] = None, type_selector: DataObjectTypeSelector = DataObjectTypeSelector. PREFER_RUN): self.name = name self.headers = headers self.template = template self.attribute_constraints = attribute_constraints self.type_selector = type_selector
class AttributeInOutput(Serializable['AttributeInOutput'], Variable): """[ALPHA] Attribute marked by an attribute template in the trunk of the history tree. The search for an attribute that marks the given attribute template starts at the root of the material history tree and proceeds until any of the given process templates are reached. Those templates block the search from continuing into their ingredients but do not halt the search entirely. This variable definition allows attributes that are present both in output and the inputs of a process to be distinguished. For example, a material "paint" might be produced by mixing and then resting "pigments" and a "base". The color of the pigments and base could be measured and recorded as attributes in addition to the color of the resulting paint. To define a variable as the color of the resulting paint, AttributeInOutput can be used with the mixing process included in the list of process templates. Then, when the platform looks for colors, it won't traverse through the mixing process and hit the colors of the pigments and base as well, which would result in an ambiguous variable match. Unlike "AttributeByTemplateAfterProcess", AttributeInOutput will also match on the color attribute of the pigments in the rows that correspond to those pigments. This way, all the colors can be assigned to the same variable and rendered into the same columns in the GEM table. Parameters --------- name: str a short human-readable name to use when referencing the variable headers: list[str] sequence of column headers attribute_template: LinkByUID attribute template that identifies the attribute to assign to the variable process_templates: list[LinkByUID] process templates that should not be traversed through when searching for a matching attribute. The attribute may be present in these processes but not their ingredients. attribute_constraints: Optional[list[(LinkByUID, Bounds)]] constraints on object attributes in the target object that must be satisfied. Constraints are expressed as Bounds. Attributes are expressed with links. The attribute that the variable is being set to may be the target of a constraint as well. type_selector: DataObjectTypeSelector strategy for selecting data object types to consider when matching, defaults to PREFER_RUN """ name = properties.String('name') headers = properties.List(properties.String, 'headers') attribute_template = properties.Object(LinkByUID, 'attribute_template') process_templates = properties.List(properties.Object(LinkByUID), 'process_templates') attribute_constraints = properties.Optional( properties.List( properties.SpecifiedMixedList( [properties.Object(LinkByUID), properties.Object(BaseBounds)] ) ), 'attribute_constraints') type_selector = properties.Enumeration(DataObjectTypeSelector, "type_selector") typ = properties.String('type', default="attribute_in_trunk", deserializable=False) def _attrs(self) -> List[str]: return ["name", "headers", "attribute_template", "process_templates", "attribute_constraints", "type_selector", "typ"] def __init__(self, *, name: str, headers: List[str], attribute_template: LinkByUID, process_templates: List[LinkByUID], attribute_constraints: Optional[List[List[Union[LinkByUID, BaseBounds]]]] = None, type_selector: DataObjectTypeSelector = DataObjectTypeSelector.PREFER_RUN): self.name = name self.headers = headers self.attribute_template = attribute_template self.process_templates = process_templates self.attribute_constraints = attribute_constraints self.type_selector = type_selector