Output#
- class maize.core.interface.Output(*args: Any, **kwargs: Any)[source]#
Bases:
Port[T]Output port to allow sending arbitrary data.
- Parameters:
timeout – Timeout used for continuously polling the connection for sending data into a potentially full channel.
mode – Whether to
'link','move'or'copy'(default) files.
- name#
Unique port name
- parent#
Parent node instance this port is part of
- Raises:
PortException – If the port is used without a connected channel
- __init__(timeout: float = 0.5, optional: bool = False, mode: Literal['copy', 'link', 'move'] = 'copy') None#
Methods
__init__([timeout, optional, mode])build(name, parent)Instantiate an interface from the description.
check(value)Checks if a value is valid using type annotations.
close()Closes the port.
is_connected(port)Specifies whether the port is connected.
send(item)Sends data through the channel.
set_channel(channel)Set the channel associated with the port.
Attributes
Specifies whether the port is active or not.
Specifies whether the port is connected.
Provides a unique path to the interface.
Provides a serialized summary of the parameter
Returns the approximate number of items waiting in the channel
datatypedoc- build(name: str, parent: Component) _TInter#
Instantiate an interface from the description.
- Parameters:
name – Name of the interface, will typically be the attribute name of the parent object
parent – Parent component instance
- Returns:
Copy of the current instance, with references to the name and the parent
- Return type:
_TInter
- check(value: T) bool#
Checks if a value is valid using type annotations.
- Parameters:
value – Value to typecheck
- Returns:
Trueif the value is valid,Falseotherwise- Return type:
- close() None#
Closes the port.
This can be detected by neighbouring nodes waiting on the port, and subsequently cause them to shut down.
- Raises:
PortException – If the port is not connected
- static is_connected(port: _PortType) TypeGuard[_PortChannel[T]]#
Specifies whether the port is connected.
- send(item: T) None[source]#
Sends data through the channel.
- Parameters:
item – Item to send through the channel
- Raises:
PortException – If trying to send through an unconnected port
Examples
In the run method of the sending node:
>>> self.output.send(42)