model_item

glotaran.model.item.model_item(properties: None | dict[str, dict[str, Any]] = None, has_type: bool = False, has_label: bool = True) Callable[source]

The @model_item 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_item 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.

  • has_label – If false no label property will be added.