AttributeRuleset
PythonThis class defines a powerful and flexible way to customize the conversion process for specific entities in the model.
AttributeRuleset()This class defines a powerful and flexible way to customize the conversion process for specific entities in the model.
Multiple attributes can be specified and allow slicing the model by entity type, entity identifier(s), or a specific combination of both.
The type field can be a specific entity type (e.g., CONV_2D) or * for all types.
The id field can be a specific entity identifier or a list of identifiers.
Since multiple attributes can be applied to the same entity, precedence is given based on the pair:
- (1, 1) if both type and id are specified and match
- (1, 0) if type is specified and id is not
- (0, 1) if id is specified and type is not
- (0, 0) if neither is specified
Currently, if multiple attributes have the same precedence, the last one in the list will be used.
type
Pythontype: str = Field(default='*', description='Entity type (e.g. CONV_2D) or * for all')The entity type (e.g. CONV_2D or PERSISTENT) or * for all.
id
Pythonid: str | list[str] | None = Field(default=None, description='Entity identifier(s)')The entity identifier or list of identifiers.
attributes
Pythonattributes: dict[str, BasicType] = Field(..., description='Entity attributes', default_factory=dict)A dictionary of entity attributes.