betty.attr module

The Attr API.

class betty.attr.Attr[source]

Bases: Generic[_InstanceT, _ValueT], ABC

A base class for an immutable property-like attribute.

__init__(attr_name: str)[source]
get_attr(instance: _InstanceT) _ValueT[source]

Get the attribute value.

abstract new_attr(instance: _InstanceT) _ValueT[source]

Create a new attribute value.

class betty.attr.MutableAttr[source]

Bases: Generic[_InstanceT, _ValueT, _SetT], Attr[_InstanceT, _ValueT]

A base class for a mutable property-like attribute.

abstract del_attr(instance: _InstanceT) None[source]

Delete the attribute value.

abstract set_attr(instance: _InstanceT, value: _SetT) None[source]

Set the attribute value.