@@ -39,10 +39,11 @@ def net_income(income, tax):
3939combined = dags.concatenate_functions(
4040 functions = {" income" : income, " tax_rate" : tax_rate, " tax" : tax, " net_income" : net_income},
4141 targets = [" net_income" , " tax" ],
42+ return_type = " dict" ,
4243)
4344
4445result = combined()
45- # result = {"net_income": 35000, "tax": 15000}
46+ # result = {"net_income": 35000.0 , "tax": 15000.0 }
4647```
4748
4849### Providing External Inputs
@@ -59,25 +60,33 @@ def net_income(income, tax):
5960combined = dags.concatenate_functions(
6061 functions = {" tax" : tax, " net_income" : net_income},
6162 targets = [" net_income" ],
63+ return_type = " dict" ,
6264)
6365
6466# income and tax_rate are external inputs
6567result = combined(income = 50000 , tax_rate = 0.3 )
66- # result = {"net_income": 35000}
68+ # result = {"net_income": 35000.0 }
6769```
6870
6971### Return Types
7072
71- By default, ` concatenate_functions ` returns a dictionary . You can also get a tuple :
73+ By default, ` concatenate_functions ` returns a tuple . You can also get a dictionary :
7274
7375``` python
76+ # Default: returns tuple
7477combined = dags.concatenate_functions(
7578 functions = functions,
7679 targets = [" a" , " b" , " c" ],
77- return_type = " tuple" , # or "dict" (default)
7880)
79-
8081a, b, c = combined()
82+
83+ # Returns dictionary with target names as keys
84+ combined = dags.concatenate_functions(
85+ functions = functions,
86+ targets = [" a" , " b" , " c" ],
87+ return_type = " dict" ,
88+ )
89+ result = combined() # {"a": ..., "b": ..., "c": ...}
8190```
8291
8392## Inspecting the DAG
@@ -125,14 +134,14 @@ args = dags.get_free_arguments(my_func)
125134
126135### Getting Type Annotations
127136
128- {func}` ~dags.get_annotations ` returns type annotations as strings :
137+ {func}` ~dags.get_annotations ` returns type annotations:
129138
130139``` python
131140def my_func (a : int , b : float ) -> float :
132141 return a + b
133142
134143annotations = dags.get_annotations(my_func)
135- # annotations = {"a": " int" , "b": " float" , "return": " float" }
144+ # annotations = {"a": int, "b": float, "return": float}
136145```
137146
138147## Renaming Arguments
0 commit comments