tierkreis.data.core¶
Core types in tierkreis.
PortID = str, name of an output on a node
NodeIndex = int, index of node in the graph list
- ValueRef = tuple[NodeIndex, PortID] reference of a value;
uniquely identified by the node and its output.
Module Contents¶
Classes¶
A model without content. |
|
A NamedTuple whose members are restricted to being of type T. |
|
Serializer for tkr values. |
|
Serializer for tkr values. |
Functions¶
Get the possible type generic T from a type. |
|
Get the serializer for an annotated type. |
|
Get the deserializer for an annotated type. |
Data¶
API¶
- PortID = None¶
- NodeIndex = None¶
- ValueRef = None¶
- SerializationFormat = None¶
- class EmptyModel¶
Bases:
typing.NamedTupleA model without content.
- class RestrictedNamedTuple¶
Bases:
typing.ProtocolA NamedTuple whose members are restricted to being of type T.
- __getitem__(key: SupportsIndex, /) T¶
Access the indexed element as in a tuple.
- __slots__ = ()¶
- classmethod __init_subclass__(*args, **kwargs)¶
- classmethod __class_getitem__(item)¶
- class Serializer¶
Serializer for tkr values.
- Fields:
- serializer (Callable[[Any], Any]): A function taking a value producing a
serialized version of it.
- serialization_method (Literal): Indicator of serializer type of
[“bytes”, “json”, “unknown”], defaults to “bytes”.
- serializer: collections.abc.Callable[[Any], Any] = None¶
- serialization_method: tierkreis.data.core.SerializationFormat = 'bytes'¶
- class Deserializer¶
Serializer for tkr values.
- Fields:
- serializer (Callable[[Any], Any]): A function taking a serialized
value producing a deserialized value.
- serialization_method (Literal): Indicator of serializer type of
[“bytes”, “json”, “unknown”], defaults to “bytes”.
- deserializer: collections.abc.Callable[[Any], Any] = None¶
- serialization_method: tierkreis.data.core.SerializationFormat = 'bytes'¶
- get_t_from_args(t: type[tierkreis.data.core.get_t_from_args.T], hint: type | None) tierkreis.data.core.get_t_from_args.T | None¶
Get the possible type generic T from a type.
- Returns:
The generic hint T if it exists on the value. Either from its annotation or type hint.
- Return type:
T | None
- get_serializer(hint: type | None) tierkreis.data.core.Serializer | None¶
Get the serializer for an annotated type.
This is relevant for annotated worker types AnnotatedType = Annotated[BaseType, ser, deser] worker_fn: AnnotatedType -> AnnotatedType
- Parameters:
hint (type | None) – The type to get the serializer for.
- Returns:
The deserializer if one is annotated.
- Return type:
Deserializer | None
- get_deserializer(hint: type | None) tierkreis.data.core.Deserializer | None¶
Get the deserializer for an annotated type.
This is relevant for annotated worker types AnnotatedType = Annotated[BaseType, ser, deser] worker_fn: AnnotatedType -> AnnotatedType
- Parameters:
hint (type | None) – The type to get the deserializer for.
- Returns:
The deserializer if one is annotated.
- Return type:
Deserializer | None