Attribute

class propertyestimator.attributes.Attribute(docstring, type_hint, default_value=<propertyestimator.attributes.attributes.UndefinedAttribute object>, optional=False, read_only=False)[source]

A custom descriptor used to add useful metadata to class attributes.

This decorator expects the object to have a matching private field in addition to the public attribute. For example if an object has an attribute substance, the object must also have a _substance field.

Notes

The attribute class will automatically create this private attribute on the object and populate it with the default value.

__init__(docstring, type_hint, default_value=<propertyestimator.attributes.attributes.UndefinedAttribute object>, optional=False, read_only=False)[source]

Initializes a new Attribute object.

Parameters
  • docstring (str) – A docstring describing the attributes purpose. This will automatically be decorated with additional information such as type hints, default values, etc.

  • type_hint (type, typing.Union) – The expected type of this attribute. This will be used to help the workflow engine ensure that expected input types match corresponding output values.

  • default_value (Any) – The default value for this attribute.

  • optional (bool) – Defines whether this is an optional input of a class. If true, the default_value should be set to UNDEFINED.

  • read_only (bool) – Defines whether this attribute is read-only.

Methods

__init__(docstring, type_hint[, …])

Initializes a new Attribute object.