betty.typing module

Providing typing utilities.

class betty.typing.Void[source]

Bases: object

A sentinel that describes the absence of a value.

Using this sentinel allows for actual values to be None. Like None, Void is only ever used through its type, and never instantiated.

static __new__(cls)[source]
betty.typing.internal(target: _T) _T[source]

Mark a target as internal to Betty.

Anything decorated with @internal MAY be used anywhere in Betty’s source code, but MUST be considered private by third-party code.

This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

betty.typing.none_void(value: _T | type[Void]) _T | None[source]

Passthrough a value, but convert betty.typing.Void to None.

betty.typing.public(target: _T) _T[source]

Mark a target as publicly usable.

This is intended for items nested inside something marked with betty.typing.internal(), such as class attributes: third-party code SHOULD NOT use a class marked @internal directly, but MAY use any of its attributes that are marked @public.

This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

betty.typing.void_none(value: _T | None) _T | type[Void][source]

Passthrough a value, but convert None to betty.typing.Void.