diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index b178568c723e..5b3d5eb40ee0 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -184,7 +184,7 @@ def __init__(self, tool, input_source, context=None): self.validators.append(validation.Validator.from_element(self, elem)) @property - def visible(self): + def visible(self) -> bool: """Return true if the parameter should be rendered on the form""" return True @@ -219,7 +219,7 @@ def get_dependencies(self): """ return [] - def to_json(self, value, app, use_security): + def to_json(self, value, app, use_security) -> str: """Convert a value to a string representation suitable for persisting""" return unicodify(value) @@ -249,12 +249,12 @@ def value_from_basic(self, value, app, ignore_errors=False): else: return self.to_python(value, app) - def value_to_display_text(self, value): + def value_to_display_text(self, value) -> str: if is_runtime_value(value): return "Not available." return self.to_text(value) - def to_text(self, value): + def to_text(self, value) -> str: """ Convert a value to a text representation suitable for displaying to the user @@ -292,7 +292,7 @@ def to_param_dict_string(self, value, other_values=None) -> str: value = sanitize_param(value) return value - def validate(self, value, trans=None): + def validate(self, value, trans=None) -> None: if value in ["", None] and self.optional: return for validator in self.validators: @@ -435,8 +435,6 @@ def __init__(self, tool, input_source): int(self.value) except ValueError: raise ParameterValueError("the attribute 'value' must be an integer", self.name) - elif self.value is None and not self.optional: - raise ParameterValueError("the attribute 'value' must be set for non optional parameters", self.name, None) self.min = input_source.get("min") self.max = input_source.get("max") if self.min: @@ -511,8 +509,6 @@ def __init__(self, tool, input_source): float(self.value) except ValueError: raise ParameterValueError("the attribute 'value' must be a real number", self.name, self.value) - elif self.value is None and not self.optional: - raise ParameterValueError("the attribute 'value' must be set for non optional parameters", self.name, None) if self.min: try: self.min = float(self.min) @@ -1317,7 +1313,7 @@ def get_options(self, trans, other_values): def get_initial_value(self, trans, other_values): if self.default_value is not None: return self.default_value - return SelectToolParameter.get_initial_value(self, trans, other_values) + return super().get_initial_value(trans, other_values) def get_legal_values(self, trans, other_values, value): if self.data_ref not in other_values and not trans.workflow_building_mode: @@ -2606,7 +2602,7 @@ class DirectoryUriToolParameter(SimpleTextToolParameter): def __init__(self, tool, input_source, context=None): input_source = ensure_input_source(input_source) - SimpleTextToolParameter.__init__(self, tool, input_source) + super().__init__(tool, input_source) def validate(self, value, trans=None): super().validate(value, trans=trans) @@ -2629,7 +2625,7 @@ class RulesListToolParameter(BaseJsonToolParameter): def __init__(self, tool, input_source, context=None): input_source = ensure_input_source(input_source) - BaseJsonToolParameter.__init__(self, tool, input_source) + super().__init__(tool, input_source) self.data_ref = input_source.get("data_ref", None) def to_dict(self, trans, other_values=None): diff --git a/test/functional/tools/integer_default.xml b/test/functional/tools/integer_default.xml new file mode 100644 index 000000000000..ae8e5dbd15c9 --- /dev/null +++ b/test/functional/tools/integer_default.xml @@ -0,0 +1,33 @@ + + '$out_file1' + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/functional/tools/sample_tool_conf.xml b/test/functional/tools/sample_tool_conf.xml index 6069630972b8..c706069d2bb0 100644 --- a/test/functional/tools/sample_tool_conf.xml +++ b/test/functional/tools/sample_tool_conf.xml @@ -218,6 +218,7 @@ +