[WIP] track abstract inputs type in tool source interface.

This commit is contained in:
John Chilton
2026-02-12 10:50:13 -05:00
parent 8e208fcf39
commit dddcf09855
4 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -452,7 +452,7 @@ def input_models_for_tool_source(tool_source: ToolSource) -> ToolParameterBundle
def input_models_for_pages(pages: PagesSource, profile: float) -> List[ToolParameterT]:
input_models = []
if pages.inputs_defined:
if pages.inputs_style != "none":
for page_source in pages.page_sources:
input_models.extend(input_models_for_page(page_source, profile))
+11 -3
View File
@@ -453,6 +453,9 @@ class ToolSource(metaclass=ABCMeta):
"""Return the tool source as a string"""
InputsStyleT = Literal["cheetah", "cwl", "none"]
class PagesSource:
"""Contains a list of Pages - each a list of InputSources -
each item in the outer list representing a page of inputs.
@@ -460,12 +463,17 @@ class PagesSource:
be exactly a singleton.
"""
def __init__(self, page_sources):
def __init__(self, page_sources, inputs_style: InputsStyleT = "cheetah"):
self.page_sources = page_sources
self._inputs_style = inputs_style
@property
def inputs_defined(self):
return True
def inputs_defined(self) -> bool:
return self._inputs_style != "none"
@property
def inputs_style(self) -> InputsStyleT:
return self._inputs_style
class DynamicOptions(metaclass=ABCMeta):
+4 -1
View File
@@ -56,6 +56,7 @@ from .interface import (
DrillDownDynamicOptions,
DynamicOptions,
InputSource,
InputsStyleT,
PageSource,
PagesSource,
RequiredFiles,
@@ -1353,11 +1354,13 @@ class XmlPagesSource(PagesSource):
def __init__(self, root):
self.input_elem = root.find("inputs")
page_sources = []
inputs_style: InputsStyleT = "none"
if self.input_elem is not None:
inputs_style = "cheetah"
pages_elem = self.input_elem.findall("page")
for page in pages_elem or [self.input_elem]:
page_sources.append(XmlPageSource(page))
super().__init__(page_sources)
super().__init__(page_sources, inputs_style)
@property
def inputs_defined(self):
+1 -1
View File
@@ -174,7 +174,7 @@ class YamlToolSource(ToolSource):
def parse_input_pages(self) -> PagesSource:
# All YAML tools have only one page (feature is deprecated)
page_source = YamlPageSource(self.root_dict.get("inputs", {}))
return PagesSource([page_source])
return PagesSource([page_source], "cwl")
def parse_strict_shell(self):
# TODO: Add ability to disable this.