Skip to content

Commit ccd401f

Browse files
committed
[WIP] track abstract inputs type in tool source interface.
1 parent 08f3579 commit ccd401f

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

lib/galaxy/tool_util/parser/interface.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,19 +446,27 @@ def to_string(self) -> str:
446446
"""Return the tool source as a string"""
447447

448448

449+
InputsStyleT = Literal["cheetah", "cwl", "none"]
450+
451+
449452
class PagesSource:
450453
"""Contains a list of Pages - each a list of InputSources -
451454
each item in the outer list representing a page of inputs.
452455
Pages are deprecated so ideally this outer list will always
453456
be exactly a singleton.
454457
"""
455458

456-
def __init__(self, page_sources):
459+
def __init__(self, page_sources, inputs_style: InputsStyleT = "cheetah"):
457460
self.page_sources = page_sources
461+
self._inputs_style = inputs_style
458462

459463
@property
460-
def inputs_defined(self):
461-
return True
464+
def inputs_defined(self) -> bool:
465+
return self._inputs_style != "none"
466+
467+
@property
468+
def inputs_style(self) -> InputsStyleT:
469+
return self._inputs_style
462470

463471

464472
class DynamicOptions(metaclass=ABCMeta):

lib/galaxy/tool_util/parser/xml.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
DrillDownDynamicOptions,
5757
DynamicOptions,
5858
InputSource,
59+
InputsStyleT,
5960
PageSource,
6061
PagesSource,
6162
RequiredFiles,
@@ -1339,11 +1340,13 @@ class XmlPagesSource(PagesSource):
13391340
def __init__(self, root):
13401341
self.input_elem = root.find("inputs")
13411342
page_sources = []
1343+
inputs_style: InputsStyleT = "none"
13421344
if self.input_elem is not None:
1345+
inputs_style = "cheetah"
13431346
pages_elem = self.input_elem.findall("page")
13441347
for page in pages_elem or [self.input_elem]:
13451348
page_sources.append(XmlPageSource(page))
1346-
super().__init__(page_sources)
1349+
super().__init__(page_sources, inputs_style)
13471350

13481351
@property
13491352
def inputs_defined(self):

lib/galaxy/tool_util/parser/yaml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def parse_requirements_and_containers(self):
161161
def parse_input_pages(self) -> PagesSource:
162162
# All YAML tools have only one page (feature is deprecated)
163163
page_source = YamlPageSource(self.root_dict.get("inputs", {}))
164-
return PagesSource([page_source])
164+
return PagesSource([page_source], "cwl")
165165

166166
def parse_strict_shell(self):
167167
# TODO: Add ability to disable this.

0 commit comments

Comments
 (0)