betty.prop module

The property API.

class betty.prop.HasProps

Bases: object

An object that has properties.

__init__(*args: Any, **kwargs: Any)
final classmethod props() Iterable[Prop[Self, Any]]

Get all properties on this class.

exception betty.prop.NotSettable

Bases: OwnerError

Raised when a property is not settable.

__init__(prop: SettableProp[OwnerT, Any, Any], owner: OwnerT, /)
exception betty.prop.OwnerError

Bases: PropError, AttributeError

Raised for property errors on a specific owner instance.

__init__(prop: Prop[OwnerT, Any], owner: OwnerT, message: str, /)
class betty.prop.Prop

Bases: ABC, Generic

A property.

abstractmethod get(owner: OwnerT, /) GetT

Get the property value from the owner.

init_owner(owner: OwnerT, /) None

Initialize the property on an owner.

property prop: PropDefinition[OwnerT]

The property definition.

final class betty.prop.PropDefinition

Bases: Generic

The definition of a property on a class.

__init__(owner: type[OwnerT], name: str) None
property id: str

The global property ID.

name: str
owner: type[OwnerT]
exception betty.prop.PropError

Bases: Exception

Raised for property API errors.

__init__(prop: Prop, message: str, *args: Any, **kwargs: Any)
class betty.prop.ProxyProp

Bases: Prop, Generic

A property that proxies another property.

__init__(*args: Any, proxied: Prop[OwnerT, GetT], **kwargs: Any)
get(owner: OwnerT, /) GetT

Get the property value from the owner.

init_owner(owner: OwnerT, /) None

Initialize the property on an owner.

class betty.prop.SettableProp

Bases: Prop, Generic

A property whose value can be set.

set(owner: OwnerT, value: SetT, /) None

Set the value on the owner.

Raises:

NotSettable