VarType#
- class tierkreis.core.types.VarType(name: str)[source]#
Bases:
TierkreisType
Named type variable.
Methods
For composite types (e.g. Struct, Vec, Map), list the child types that define it concretely.
contained_vartypes
Attempts to convert a protobuf type to a TierkreisType subclass.
Create a TierkreisType from a corresponding Python type.
Create a TierkreisType from a Union type.
Register an alternative type that can be used to convert to/from TierkreisType.
Converts a tierkreis type to its protobuf representation.
Attributes
name
- children() list[TierkreisType] #
For composite types (e.g. Struct, Vec, Map), list the child types that define it concretely.
- classmethod from_proto(type_: Type) TierkreisType #
Attempts to convert a protobuf type to a TierkreisType subclass.
- classmethod from_python(type_: Type, visited_types: dict[Type, TierkreisType] | None = None) TierkreisType #
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:
IncompatibleUnionType – Failure to convert a Union.
IncompatiblePyType – Python type cannot be converted to a Tierkreis type.
- Returns:
TierkreisType
- classmethod from_python_union(type_: UnionType, visited_types: dict[Type, TierkreisType] | None = None) TierkreisType #
Create a TierkreisType from a Union type.
- classmethod register_alternative(type_: Type, alternative: Type[SerializeAs])#
Register an alternative type that can be used to convert to/from TierkreisType.