tethys.core.networks.network_zero
¶
Module Contents¶
-
class
tethys.core.networks.network_zero.
ZeroNetwork
(*pipes: Union[Iterable[Union['ZeroPipe', str]], Union['ZeroPipe', str]], **kwargs)[source]¶ Bases:
tethys.core.regobjs.regobj_zero.ZeroRegistrableObject
,tethys.core.networks.network_base.NetworkBase
The Network entity class of the Zero generation. The ZeroNetwork is a container of the Pipes.
- Example:
pipe1 = ZeroPipe( node_a=node1, node_b=node2 ) pipe2 = ZeroPipe( node_a=node2, node_b=node1 ) pipe3 = ZeroPipe( node_a=node3, node_b=node1 ) pipe4 = ZeroPipe( node_a=node3, node_b=node2 ) network_template = ZeroNetwork([pipe1, pipe2]) network = ZeroNetwork() network.add_pipes(pipe3, pipe4) result_network = network_template + network
- Parameters
pipes (Iterable[Union[ZeroPipe, str]) – list of args of the pipes (str or PipeZero instances) - can be empty
-
CLASS_PATH
= /networks/[source]¶ ZeroNetwork
instances collection path in the repository
-
FIELDS_SCHEMA
[source]¶ ZeroNetwork
fields validators
-
property
input_nodes
(self) → Iterator['ZeroNode'][source]¶ It returns input nodes
- Example:
<in> —> Node1 —> Node2 —> <out>
Node1 - input node
- Returns
list of the input nodes
- Return type
Iterable[ZeroNode]
-
property
output_nodes
(self) → Iterator['ZeroNode'][source]¶ It returns output nodes
- Example:
<in> —> Node1 —> Node2 —> <out>
Node2 - output node (because –> <out>)
- Returns
list of the output nodes
- Return type
Iterable[ZeroNode]
-
property
input_pipes
(self) → Iterator[ZeroPipe][source]¶ It returns input pipes
- Example:
<in> –pipe1–> N –pipe2–> N –pipe3–> <out>
pipe1 - input pipe
- Returns
list of the input pipes
- Return type
Iterable[ZeroPipe]
-
property
output_pipes
(self) → Iterator[ZeroPipe][source]¶ It returns input pipes
- Example:
<in> –pipe1–> N –pipe2–> N –pipe3–> <out> <–pipe4– N
pipe3 and pipe4 - output pipes
- Returns
list of the output pipes
- Return type
Iterable[ZeroPipe]
-
get_forward_pipes
(self, pipe_or_node: Union[ZeroNode, ZeroPipe]) → Iterator[ZeroPipe][source]¶ Get all pipes that go after the pipe_or_node instance.
- Example:
<in> –p1–> N1 –p2–> N2 –p3–> <out>
If p1 or N1 - target instance (pipe_or_node) then p2- forward pipe
-
get_backward_pipes
(self, pipe_or_node: Union[ZeroNode, ZeroPipe]) → Iterator[ZeroPipe][source]¶ Get all pipes that go after the pipe_or_node instance.
- Example:
<in> –p1–> N1 –p2–> N2 –p4–> <out>
If N1 or p2 - target instance (pipe_or_node) then p1 - backward pipe
-
get_pipes_map
(self, reverse: bool = False, **kwargs) → Dict[str, Dict[str, Dict[str, Union[ZeroPipe, None]]]][source]¶ It returns pipes map like 3d array
-
add_pipes
(self, *pipes: Union[Iterable[Union[ZeroPipe, str]], Union[ZeroPipe, str]])[source]¶ It adds pipes to the ZeroNetwork instance
-
remove_pipes
(self, *pipes: Union[Iterable[Union['ZeroPipe', str]], Union['ZeroPipe', str]])[source]¶ It removes pipes from the Network