tierkreis.idl.models

Tierkreis IDL models representation used for TSP parsing.

Module Contents

Classes

GenericType

A Tierkreis worker generic type.

TypedArg

A Tierkreis worker method argument.

Method

A Tierkreis worker method.

Interface

A Tierkreis worker interface.

Model

A Tierkreis worker model.

API

class tierkreis.idl.models.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]]

origin: tierkreis.idl.models.ElementaryType = None
args: Sequence[GenericType | str] = None
classmethod from_type(t: type) Self

Construct a generic type from a python type.

Parameters:

t (type) – The python type.

Returns:

The Tierkreis type.

Return type:

Self

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]

__hash__() int

Produce a hash of the generic type.

Returns:

The hash.

Return type:

int

__eq__(value: object) bool

Check the equality of self with an object.

self == value <==> self.origin == value.origin

Parameters:

other (object) – The object to compare to.

Returns:

If both object have the same origin.

Return type:

bool

class tierkreis.idl.models.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.

name: str = None
t: tierkreis.idl.models.GenericType = None
has_default: bool = False
class tierkreis.idl.models.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
return_type_is_portmapping: bool = False
class tierkreis.idl.models.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.

name: str = None
methods: list[tierkreis.idl.models.Method] = None
class tierkreis.idl.models.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.

is_portmapping: bool = None
t: tierkreis.idl.models.GenericType = None
decls: list[tierkreis.idl.models.TypedArg] = None
__hash__() int

Produce a hash of the model.

Returns:

The hash.

Return type:

int

__lt__(other: tierkreis.idl.models.Model) bool

Check order of two models.

Uses lexicographical ordering of the origin of the models (generic) types.

Parameters:

other (Model) – The model to compare to.

Returns:

If self comes before other.

Return type:

bool