From fc786e068657f389b0b123b923b0831b9e603ea0 Mon Sep 17 00:00:00 2001 From: guerler Date: Wed, 11 Oct 2023 22:59:51 +0300 Subject: [PATCH] Move matching of library_data input to data input to basic.py --- lib/galaxy/tool_util/parser/xml.py | 7 ------- lib/galaxy/tool_util/parser/yaml.py | 7 ------- lib/galaxy/tools/parameters/basic.py | 10 ++++++++-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/galaxy/tool_util/parser/xml.py b/lib/galaxy/tool_util/parser/xml.py index ae1f03a3fa11..60c6b935a251 100644 --- a/lib/galaxy/tool_util/parser/xml.py +++ b/lib/galaxy/tool_util/parser/xml.py @@ -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") diff --git a/lib/galaxy/tool_util/parser/yaml.py b/lib/galaxy/tool_util/parser/yaml.py index c7f5a52d6883..64c8381b0e37 100644 --- a/lib/galaxy/tool_util/parser/yaml.py +++ b/lib/galaxy/tool_util/parser/yaml.py @@ -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": diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 61b7423dbd18..390cf277f1c2 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -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() @@ -310,7 +310,7 @@ 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: @@ -318,6 +318,12 @@ def build(cls, tool, input_source): 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()