schedr._model.types¶
Type descriptors: the type of a task’s output in DAG JSON.
Mirrors schedr-model (types.rs).
- type schedr._model.types.JsonScalar = str | int | bool | None¶
A value allowed in a
Literal[...]type.
- schedr._model.types.ScalarName¶
The types without parameters.
alias of
Literal[‘any’, ‘none’, ‘bool’, ‘int’, ‘float’, ‘str’, ‘datetime’, ‘date’, ‘timedelta’, ‘process_result’]
- class schedr._model.types.ScalarType(name)¶
Bases:
objectA type without parameters (
int,str,datetime,ProcessResult, …).- Parameters:
name (Literal['any', 'none', 'bool', 'int', 'float', 'str', 'datetime', 'date', 'timedelta', 'process_result'])
- name¶
Which type.
- Type:
Literal[‘any’, ‘none’, ‘bool’, ‘int’, ‘float’, ‘str’, ‘datetime’, ‘date’, ‘timedelta’, ‘process_result’]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": name}.- Return type:
dict[str, Any]
- class schedr._model.types.ListType(item)¶
Bases:
objectlist[T].- Parameters:
item (TypeDesc)
- item¶
The element type.
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "list", "item": ...}.- Return type:
dict[str, Any]
- class schedr._model.types.TupleType(items)¶
Bases:
objecttuple[A, B, ...].- Parameters:
items (Sequence[TypeDesc])
- items¶
The element types, in order.
- Type:
collections.abc.Sequence[schedr._model.types.TypeDesc]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "tuple", "items": [...]}.- Return type:
dict[str, Any]
- class schedr._model.types.DictType(value)¶
Bases:
objectdict[str, T].- Parameters:
value (TypeDesc)
- value¶
The value type (keys are always strings).
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "dict", "value": ...}.- Return type:
dict[str, Any]
- class schedr._model.types.LiteralType(values)¶
Bases:
objectLiteral[...].- Parameters:
values (Sequence[JsonScalar])
- values¶
The allowed values.
- Type:
collections.abc.Sequence[schedr._model.types.JsonScalar]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "literal", "values": [...]}.- Return type:
dict[str, Any]
- class schedr._model.types.UnionType(variants)¶
Bases:
objectA union, including
T | None.- Parameters:
variants (Sequence[TypeDesc])
- variants¶
The member types.
- Type:
collections.abc.Sequence[schedr._model.types.TypeDesc]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "union", "variants": [...]}.- Return type:
dict[str, Any]
- class schedr._model.types.Field(name, type, required=True)¶
Bases:
objectA named field of a
TypedDictor dataclass.- Parameters:
name (str)
type (TypeDesc)
required (bool)
- name¶
The field or key name.
- Type:
str
- type¶
The field’s type.
- required¶
Whether it must be present (
TypedDict) or has no default (dataclass).- Type:
bool
- to_json()¶
The field as DAG JSON.
- Returns:
{"name": ..., "type": ..., "required": ...}.- Return type:
dict[str, Any]
- class schedr._model.types.TypedDictType(name, fields)¶
Bases:
objectA
TypedDict.- Parameters:
name (str)
fields (Sequence[Field])
- name¶
The class name.
- Type:
str
- fields¶
The keys, in declaration order.
- Type:
collections.abc.Sequence[schedr._model.types.Field]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "typed_dict", "name": ..., "fields": [...]}.- Return type:
dict[str, Any]
- class schedr._model.types.DataclassType(name, fields)¶
Bases:
objectA dataclass.
- Parameters:
name (str)
fields (Sequence[Field])
- name¶
The class name (also the outcome name in outcome unions).
- Type:
str
- fields¶
The fields, in declaration order.
- Type:
collections.abc.Sequence[schedr._model.types.Field]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "dataclass", "name": ..., "fields": [...]}.- Return type:
dict[str, Any]
- class schedr._model.types.ModelType(name, schema)¶
Bases:
objectA Pydantic model, described by Pydantic’s JSON Schema of it (decision 59).
An output’s type holds the serialization schema (what
model_dump(mode="json")writes), a parameter’s the validation schema (whatmodel_validateaccepts); a part of one (out.url) is a model type too, holding that part’s schema and the$defsits references need.- Parameters:
name (str)
schema (Mapping[str, Any])
- name¶
The class name (also the outcome name in outcome unions), or the part’s path for a part (
Remote.url).- Type:
str
- schema¶
The JSON Schema.
- Type:
collections.abc.Mapping[str, Any]
- to_json()¶
The type as DAG JSON.
- Returns:
{"type": "model", "name": ..., "schema": ...}.- Return type:
dict[str, Any]
- type schedr._model.types.TypeDesc = ScalarType | ListType | TupleType | DictType | LiteralType | UnionType | TypedDictType | DataclassType | ModelType¶
Any type descriptor.