File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Expand file tree Collapse file tree 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):
8181 if meta_param .samplesheet is not True :
8282 continue
8383
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 ]):
9485 click .secho (
9586 f"parameter marked as samplesheet is not valid: { name } "
9687 f"in workflow { f .__name__ } must be a list of dataclasses" ,
@@ -108,3 +99,21 @@ def decorator(f: Callable):
10899 return _workflow (f , wf_name_override = wf_name_override )
109100
110101 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