model_attribute

glotaran.model.attribute.model_attribute(properties: Any | dict[str, dict[str, Any]] = {}, has_type: bool = False, no_label: bool = False)Callable[source]

The @model_attribute decorator adds the given properties to the class. Further it adds classmethods for deserialization, validation and printing.

By default, a label property is added.

The properties dictionary contains the name of the properties as keys. The values must be either a type or dictionary with the following values:

  • type: a type (required)

  • doc: a string for documentation (optional)

  • default: a default value (optional)

  • allow_none: if True, the property can be set to None (optional)

Classes with the model_attribute decorator intended to be used in glotaran models.

Parameters
  • properties – A dictionary of property names and options.

  • has_type – If true, a type property will added. Used for model attributes, which can have more then one type.

  • no_label – If true no label property will be added.