input

class InputScope(*values)[source]

The scope that input must be provided in

tube = 'tube'
process = 'process'
pydantic model InputSpecification[source]

Specification of inputs to a noob tube.

Inputs can be supplied at different times and frequencies, as specified by scope:

tube-scoped inputs may be used in a node’s param specification, and process-scoped inputs may be used as one of a node’s depends.

Inputs can be supplied at a “higher” scope and be accessed by lower scopes: e.g. input requested with a process scope can use input provided when instantiating the tube, if not provided to process but provided to the tube.

Config:
  • extra: str = forbid

Fields:
field default: Any | None = None
field description: str | None = None

An optional description of the input value

field id: Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)] [Required]
Constraints:
  • func = <function _not_reserved at 0x7e4782245120>

field scope: InputScope = InputScope.tube
field type_: Annotated[str, AfterValidator(func=_is_absolute_identifier)] [Required] (alias 'type')
Constraints:
  • func = <function _is_absolute_identifier at 0x7e4782244ea0>

pydantic model InputCollection[source]

A collection of input specifications used during runtime, split by scope, to validate presence of and to combine inputs.

Fields:
field specs: dict[InputScope, dict[Annotated[str, AfterValidator(func=_is_identifier), AfterValidator(func=_not_reserved)], InputSpecification]] [Optional]
add_input(scope: InputScope, input: dict) None[source]

Add some scope’s input to the input collection.

collect(edges: list[Edge], input: dict) dict[source]
filter_input(scope: InputScope, input: dict) dict[source]

filter input to only specified keys, emitting an ExtraInput warning if found.

get(key: str, input: dict | None = None) Any[source]

Get a value from the inputs at any scope, if present

get_node_params(params: dict) dict[source]
get_node_params(params: list) list

Get tube-scoped params specified as inputs needed when instantiating a node

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

validate_input(scope: InputScope, input: dict) dict[source]

Check that the required inputs are present in one of several input dicts, and then filter to only specified input

INPUT_PATTERN: ClassVar[Pattern] = re.compile('input\\.(?P<key>.*)')
property chain: ChainMap

Make a chainmap of inputs at different scopes

(for possible expansion of number of scopes, to e.g. a runner scope)

property defaults: dict[source]

A dict of any of the defaults set in tube specs