12
12
13
13
def concatenate_functions (
14
14
functions ,
15
- targets ,
15
+ targets = None ,
16
16
return_type = "tuple" ,
17
17
aggregator = None ,
18
18
enforce_signature = True ,
@@ -31,8 +31,8 @@ def concatenate_functions(
31
31
functions (dict or list): Dict or list of functions. If a list, the function
32
32
name is inferred from the __name__ attribute of the entries. If a dict,
33
33
the name of the function is set to the dictionary key.
34
- targets (str): Name of the function that produces the target or list of such
35
- function names.
34
+ targets (str | None ): Name of the function that produces the target or list of
35
+ such function names. If the value is `None`, all variables are returned .
36
36
return_type (str): One of "tuple", "list", "dict". This is ignored if the
37
37
targets are a single string or if an aggregator is provided.
38
38
aggregator (callable or None): Binary reduction function that is used to
@@ -45,8 +45,8 @@ def concatenate_functions(
45
45
function: A function that produces targets when called with suitable arguments.
46
46
47
47
"""
48
- _targets = _harmonize_targets (targets )
49
48
_functions = _harmonize_functions (functions )
49
+ _targets = _harmonize_targets (targets , list (_functions ))
50
50
_fail_if_targets_have_wrong_types (_targets )
51
51
_fail_if_functions_are_missing (_functions , _targets )
52
52
@@ -91,8 +91,8 @@ def get_ancestors(functions, targets, include_targets=False):
91
91
set: The ancestors
92
92
93
93
"""
94
- _targets = _harmonize_targets (targets )
95
94
_functions = _harmonize_functions (functions )
95
+ _targets = _harmonize_targets (targets , list (_functions ))
96
96
_fail_if_targets_have_wrong_types (_targets )
97
97
_fail_if_functions_are_missing (_functions , _targets )
98
98
@@ -113,8 +113,10 @@ def _harmonize_functions(functions):
113
113
return functions
114
114
115
115
116
- def _harmonize_targets (targets ):
117
- if isinstance (targets , str ):
116
+ def _harmonize_targets (targets , function_names ):
117
+ if targets is None :
118
+ targets = function_names
119
+ elif isinstance (targets , str ):
118
120
targets = [targets ]
119
121
return targets
120
122
0 commit comments