Skip to content

Commit 3513d6b

Browse files
committed
Refactor pipeline functions to return specific values
1 parent c049668 commit 3513d6b

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

pipelines/hello_pipeline/hello_pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ def say_hello() -> str:
1616

1717

1818
@pipeline
19-
def hello_pipeline():
20-
say_hello()
19+
def hello_pipeline() -> str:
20+
message = say_hello()
21+
return message
2122

2223

2324
if __name__ == "__main__":

pipelines/io_pipeline/io_pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ def count_rows(
3131

3232

3333
@pipeline
34-
def io_pipeline():
34+
def io_pipeline() -> int:
3535
features, labels = load_data()
36-
count_rows(features, labels)
36+
row_count = count_rows(features, labels)
37+
return row_count
3738

3839

3940
if __name__ == "__main__":

pipelines/meta_pipeline/meta_pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ def compute_accuracy() -> Annotated[float, "accuracy_metric"]:
2121

2222

2323
@pipeline
24-
def meta_pipeline():
25-
compute_accuracy()
24+
def meta_pipeline() -> float:
25+
accuracy = compute_accuracy()
26+
return accuracy
2627

2728

2829
if __name__ == "__main__":

pipelines/param_pipeline/param_pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ def multiply(number: int, factor: int = 2) -> Annotated[int, "product"]:
1919

2020

2121
@pipeline
22-
def param_pipeline(number: int = 3, factor: int = 2):
23-
multiply(number=number, factor=factor)
22+
def param_pipeline(number: int = 3, factor: int = 2) -> int:
23+
result = multiply(number=number, factor=factor)
24+
return result
2425

2526

2627
if __name__ == "__main__":

0 commit comments

Comments
 (0)