File tree 1 file changed +19
-10
lines changed
1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -81,16 +81,7 @@ def decorator(f: Callable):
81
81
if meta_param .samplesheet is not True :
82
82
continue
83
83
84
- annotation = wf_params [name ].annotation
85
-
86
- origin = get_origin (annotation )
87
- args = get_args (annotation )
88
- valid = (
89
- origin is not None
90
- and issubclass (origin , list )
91
- and is_dataclass (args [0 ])
92
- )
93
- if not valid :
84
+ if not _is_valid_samplesheet_parameter_type (wf_param [name ]):
94
85
click .secho (
95
86
f"parameter marked as samplesheet is not valid: { name } "
96
87
f"in workflow { f .__name__ } must be a list of dataclasses" ,
@@ -108,3 +99,21 @@ def decorator(f: Callable):
108
99
return _workflow (f , wf_name_override = wf_name_override )
109
100
110
101
return decorator
102
+
103
+
104
+ def _is_valid_samplesheet_parameter_type (parameter : inspect .Parameter ) -> bool :
105
+ """
106
+ Check if a parameter in the workflow function's signature is annotated with a valid type for a
107
+ samplesheet LatchParameter.
108
+ """
109
+ annotation = parameter .annotation
110
+
111
+ origin = get_origin (annotation )
112
+ args = get_args (annotation )
113
+ valid = (
114
+ origin is not None
115
+ and issubclass (origin , list )
116
+ and is_dataclass (args [0 ])
117
+ )
118
+
119
+ return valid
You can’t perform that action at this time.
0 commit comments