Skip to content

Commit

Permalink
Move matching of library_data input to data input to basic.py
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Oct 11, 2023
1 parent b9ad7e1 commit fc786e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
7 changes: 0 additions & 7 deletions lib/galaxy/tool_util/parser/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,13 +1186,6 @@ def get(self, key, value=None):
def get_bool(self, key, default):
return string_as_bool(self.get(key, default))

def get_type(self):
param_type = self.input_elem.get("type")
if param_type == "library_data":
return "data"
else:
return param_type

def parse_label(self):
return xml_text(self.input_elem, "label")

Expand Down
7 changes: 0 additions & 7 deletions lib/galaxy/tool_util/parser/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,6 @@ def get(self, key, default=None):
def get_bool(self, key, default):
return self.input_dict.get(key, default)

def get_type(self):
param_type = self.input_dict.get("type")
if param_type == "library_data":
return "data"
else:
return param_type

def parse_input_type(self):
input_type = self.input_dict["type"]
if input_type == "repeat":
Expand Down
10 changes: 8 additions & 2 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __init__(self, tool, input_source, context=None):
self.tool = tool
self.argument = input_source.get("argument")
self.name = self.__class__.parse_name(input_source)
self.type = input_source.get_type()
self.type = self.get_type(input_source)
self.hidden = input_source.get_bool("hidden", False)
self.refresh_on_change = input_source.get_bool("refresh_on_change", False)
self.optional = input_source.parse_optional()
Expand Down Expand Up @@ -310,14 +310,20 @@ def build(cls, tool, input_source):
"""Factory method to create parameter of correct type"""
input_source = ensure_input_source(input_source)
param_name = cls.parse_name(input_source)
param_type = input_source.get_type()
param_type = cls.get_type(input_source)
if not param_type:
raise ValueError(f"parameter '{param_name}' requires a 'type'")
elif param_type not in parameter_types:
raise ValueError(f"parameter '{param_name}' uses an unknown type '{param_type}'")
else:
return parameter_types[param_type](tool, input_source)

@staticmethod
def get_type(input_source):
"""Return the tool parameter input type"""
param_type = input_source.get("type")
return "data" if param_type == "library_data" else param_type

@staticmethod
def parse_name(input_source):
return input_source.parse_name()
Expand Down

0 comments on commit fc786e0

Please sign in to comment.