TierkreisType#

class tierkreis.core.types.TierkreisType[source]#

Bases: ABC

Abstract base class for all Tierkreis types.

Methods

children

For composite types (e.g. Struct, Vec, Map), list the child types that define it concretely.

contained_vartypes

from_proto

Attempts to convert a protobuf type to a TierkreisType subclass.

from_python

Create a TierkreisType from a corresponding Python type.

from_python_union

Create a TierkreisType from a Union type.

register_alternative

Register an alternative type that can be used to convert to/from TierkreisType.

to_proto

Converts a tierkreis type to its protobuf representation.

children() list[TierkreisType][source]#

For composite types (e.g. Struct, Vec, Map), list the child types that define it concretely.

classmethod from_proto(type_: Type) TierkreisType[source]#

Attempts to convert a protobuf type to a TierkreisType subclass.

classmethod from_python(type_: Type, visited_types: dict[Type, TierkreisType] | None = None) TierkreisType[source]#

Create a TierkreisType from a corresponding Python type.

Parameters:
  • type – The Python type.

  • visited_types – An optional map from previously visited Python types

  • TierkreisType (to)

  • recursively. (used when converting)

Raises:
Returns:

TierkreisType

classmethod from_python_union(type_: UnionType, visited_types: dict[Type, TierkreisType] | None = None) TierkreisType[source]#

Create a TierkreisType from a Union type.

classmethod register_alternative(type_: Type, alternative: Type[SerializeAs])[source]#

Register an alternative type that can be used to convert to/from TierkreisType.

abstract to_proto() Type[source]#

Converts a tierkreis type to its protobuf representation.