tierkreis.idl.models¶
Tierkreis IDL models representation used for TSP parsing.
Module Contents¶
Classes¶
A Tierkreis worker generic type. |
|
A Tierkreis worker method argument. |
|
A Tierkreis worker method. |
|
A Tierkreis worker interface. |
|
A Tierkreis worker model. |
API¶
- class GenericType¶
A Tierkreis worker generic type.
Represents a single (composed) type in worker definitions.
- Fields:
origin (ElementaryType): The base type, e.g., str in list[str]. args: (Sequence[GenericType | str]) The nested types.
e.g., list[str] in set[list[str]]
- is_ptype (bool): true if the type was either
constructed from a type that was a PType,
not constructed from a type at all (e.g. from a string in the parser).
has_serialization (bool): true if the type has custom serialization.
- origin: tierkreis.idl.models.ElementaryType = None¶
- args: Sequence[GenericType | str] = None¶
- classmethod from_type(t: type, *, has_serialization: bool = False) Self¶
Construct a generic type from a python type.
- included_structs() set[GenericType]¶
Find the included structs of this type.
A struct is an instance of RestrictedNamedTuple or opaque strings. :return: The list of structs :rtype: set[GenericType]
- class TypedArg¶
A Tierkreis worker method argument.
Represents a single argument to a tasks in a worker. :fields:
name (str): The argument name. t (GenericType): The argument type. has_default(bool): Whether the argument has a default value.
- t: tierkreis.idl.models.GenericType = None¶
- class Method¶
A Tierkreis worker method.
Represents a tasks in a worker.
- Fields:
name (str): The method name. args (list[TypedArg]): The list of method arguments. return_type (GenericType): The method return type. return_type_is_portmapping (bool): Whether the return_type is a portmapping.
- name: tierkreis.idl.models.GenericType = None¶
- args: list[tierkreis.idl.models.TypedArg] = None¶
- return_type: tierkreis.idl.models.GenericType = None¶
- class Interface¶
A Tierkreis worker interface.
Represents a list of tasks contained in the worker.
- Fields:
name (str): The worker name. methods (list[Method]): The available tasks in the worker.
- methods: list[tierkreis.idl.models.Method] = None¶
- class Model¶
A Tierkreis worker model.
Represents a type in a worker.
- Fields:
is_portmapping (bool): Whether the model is a portmapping. t (GenericType): The type of the model. decl (list[TypedArg]) The list of its typed arguments.
- t: tierkreis.idl.models.GenericType = None¶
- decls: list[tierkreis.idl.models.TypedArg] = None¶
- __lt__(other: tierkreis.idl.models.Model) bool¶
Check order of two models.
Uses lexicographical ordering of the origin of the models (generic) types.
- is_pmodel() bool¶
Check if the model is known to be a PModel, i.e. if all fields have types that were known to be PModels.
Raises an exception if some types are PModels and others not.
- model_dependencies(known_models: dict[str, tierkreis.idl.models.Model]) set[tierkreis.idl.models.Model]¶
Get a set of models this model depends on.
For example, if you have model A { x: int, y: B } model B { z: str } Then A depends on B.