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.private(target: _T) _T[source]

Mark a target as private to its containing scope.

This is intended for items that cannot be marked private by prefixing their names with an underscore.

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.threadsafe(target: _T) _T[source]

Mark a target as thread-safe.