betty.attrs.optional module#

Optional attributes.

class betty.attrs.optional.OptionalAttr#

Bases: ProxyAttr[OwnerT, GetT | None, SetT | None, DataDefinition[GetT | None, Porter]], Generic

Make another attribute optional, e.g. allow None.

__init__(proxied: Attr[OwnerT, GetT, SetT, DataDefinition[GetT]], /)#
final delete(owner: OwnerT, /) None#

Delete the property value from the owner.

Raises:

NotDeletable

final get(owner: OwnerT, /) GetT | None#

Get the property value from the owner.

final init_owner(owner: OwnerT, /) None#

Initialize the property on an owner.

final set(owner: OwnerT, value: SetT | None, /) None#

Set the property value on the owner.

Raises:

NotSettable