cutcutcodec.core.classes.node.Node

class cutcutcodec.core.classes.node.Node(in_streams: list[Stream] | tuple[Stream], out_streams: list[Stream] | tuple[Stream])[source]

General node of the assembly graph.

Parameters

copyboolean, default=True

If False, try to avoid realocation as much as possible. By default, the modifications are not inplace (readonly).

in_streamstuple[Stream, …]

The streams arriving on the node (readonly).

out_streamstuple[Stream, …]

The streams coming back on the node (readonly).

property copy: bool

Try to avoid realocation as much as possible if False.

getstate() dict[source]

Retrieve the internal state of the object.

Returns

statedict

An explicit dictionary containing the different attributes of the object. Even if this is not optimal in terms of memory and speed, the objects must be explicit so that they can be easily manipulated when the assembly graph is optimized. The keys must be of type str and the dictionary must to be jsonisable.

in_index(stream: Stream) int[source]

Return the input index of the stream comming on this node.

in_select(type_: str) tuple[Stream, ...][source]

Select the incoming streams of a specific type.

property in_streams: tuple[Stream, ...]

Return the incoming streams on the node.

out_index(stream: Stream) int[source]

Return the output index of the stream escaping this node.

out_select(type_: str) tuple[Stream, ...][source]

Select the outgoing streams of a specific type.

property out_streams: tuple[Stream, ...]

Return the outgoing streams on the node.

setstate(in_streams: Iterable[Stream], state: dict) None[source]

Allow to completely change the internal state of the node.

Parameters

in_streams

Same as cutcutcodec.core.classes.stream.Stream.in_streams.

statedict

The internal state returned by the getstate method of the same class.