@@ -76,6 +76,8 @@ def __init__(
76
76
77
77
def __eq__ (self , other ) -> bool :
78
78
"""
79
+ Pipeline equality is defined by the equality of their serialized form.
80
+
79
81
Equal pipelines share every metadata, node and edge, but they're not required to use
80
82
the same node instances: this allows pipeline saved and then loaded back to be equal to themselves.
81
83
"""
@@ -108,6 +110,7 @@ def __repr__(self) -> str:
108
110
def to_dict (self ) -> Dict [str , Any ]:
109
111
"""
110
112
Serializes the pipeline to a dictionary.
113
+
111
114
This is meant to be an intermediate representation but it can be also used to save a pipeline to file.
112
115
113
116
:returns:
@@ -189,8 +192,7 @@ def from_dict(
189
192
190
193
def dumps (self , marshaller : Marshaller = DEFAULT_MARSHALLER ) -> str :
191
194
"""
192
- Returns the string representation of this pipeline according to the
193
- format dictated by the `Marshaller` in use.
195
+ Returns the string representation of this pipeline according to the format dictated by the `Marshaller` in use.
194
196
195
197
:param marshaller:
196
198
The Marshaller used to create the string representation. Defaults to `YamlMarshaller`.
@@ -201,8 +203,7 @@ def dumps(self, marshaller: Marshaller = DEFAULT_MARSHALLER) -> str:
201
203
202
204
def dump (self , fp : TextIO , marshaller : Marshaller = DEFAULT_MARSHALLER ):
203
205
"""
204
- Writes the string representation of this pipeline to the file-like object
205
- passed in the `fp` argument.
206
+ Writes the string representation of this pipeline to the file-like object passed in the `fp` argument.
206
207
207
208
:param fp:
208
209
A file-like object ready to be written to.
@@ -240,8 +241,7 @@ def load(
240
241
callbacks : Optional [DeserializationCallbacks ] = None ,
241
242
) -> "Pipeline" :
242
243
"""
243
- Creates a `Pipeline` object from the string representation read from the file-like
244
- object passed in the `fp` argument.
244
+ Creates a `Pipeline` object from the string representation read from the file-like object passed in the `fp` argument.
245
245
246
246
:param data:
247
247
The string representation of the pipeline, can be `str`, `bytes` or `bytearray`.
@@ -506,9 +506,10 @@ def get_component_name(self, instance: Component) -> str:
506
506
507
507
def inputs (self ) -> Dict [str , Dict [str , Any ]]:
508
508
"""
509
- Returns a dictionary containing the inputs of a pipeline. Each key in the dictionary
510
- corresponds to a component name, and its value is another dictionary that describes the
511
- input sockets of that component, including their types and whether they are optional.
509
+ Returns a dictionary containing the inputs of a pipeline.
510
+
511
+ Each key in the dictionary corresponds to a component name, and its value is another dictionary that describes
512
+ the input sockets of that component, including their types and whether they are optional.
512
513
513
514
:returns:
514
515
A dictionary where each key is a pipeline component name and each value is a dictionary of
@@ -528,9 +529,10 @@ def inputs(self) -> Dict[str, Dict[str, Any]]:
528
529
529
530
def outputs (self ) -> Dict [str , Dict [str , Any ]]:
530
531
"""
531
- Returns a dictionary containing the outputs of a pipeline. Each key in the dictionary
532
- corresponds to a component name, and its value is another dictionary that describes the
533
- output sockets of that component.
532
+ Returns a dictionary containing the outputs of a pipeline.
533
+
534
+ Each key in the dictionary corresponds to a component name, and its value is another dictionary that describes
535
+ the output sockets of that component.
534
536
535
537
:returns:
536
538
A dictionary where each key is a pipeline component name and each value is a dictionary of
@@ -573,6 +575,7 @@ def draw(self, path: Path) -> None:
573
575
def walk (self ) -> Iterator [Tuple [str , Component ]]:
574
576
"""
575
577
Visits each component in the pipeline exactly once and yields its name and instance.
578
+
576
579
No guarantees are provided on the visiting order.
577
580
578
581
:returns:
0 commit comments