From a7e49048e677bbfdf06b5763a34116af643c8a95 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Sat, 3 Aug 2019 18:55:04 +0200 Subject: [PATCH] argument tag: replace dashes by underscores --- lib/galaxy/tool_util/xsd/galaxy.xsd | 19 ++++++++++--------- lib/galaxy/tools/parameters/basic.py | 9 ++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index cea5aa9e6f6..77e9f2a27b8 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -187,7 +187,7 @@ automatically if profile is set to any version newer than ``16.01``, such as This string specifies the minimum Python version that is able to fill the Cheetah sections of the tool. If unset defaults -to 2.7 if the profile is older than 19.01, otherwise defaults to 3.5. Galaxy will +to 2.7 if the profile is older than 19.01, otherwise defaults to 3.5. Galaxy will attempt to convert Python statements in Cheetah sections using [future](http://python-future.org/) if Galaxy is run on Python 3 and ``python_template_version`` is below 3. @@ -1788,7 +1788,7 @@ statement. A good example tool that demonstrates many conditional parameters is - + @@ -2353,9 +2353,10 @@ rendered as a one line text box (if ``false``, the default) or a multi-line text If the parameter reflects just one command line argument of a certain tool, this tag should be set to that particular argument. It is rendered in parenthesis -after the help section, and it will create the name attribute from the argument -attribute by stripping the dashes (e.g. if ``argument="--sensitive"`` then -``name="sensitive"`` is implicit). +after the help section, and it will create the name attribute (if not given explicitly) +from the argument attribute by stripping leading dashes and replacing all remaining +dashes by underscores (e.g. if ``argument="--long-parameter"`` then +``name="long_parameter"`` is implicit). ]]> @@ -3217,7 +3218,7 @@ validators is in the ``validator_types`` dictionary in [/lib/galaxy/tools/parameters/validation.py](https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/tools/parameters/validation.py). Valid values include: ``expression``, ``regex``, ``in_range``, ``length``, ``metadata``, ``unspecified_build``, ``no_options``, ``empty_field``, -``dataset_metadata_in_file``, +``dataset_metadata_in_file``, ``dataset_metadata_in_data_table``, ``dataset_metadata_not_in_data_table``, ``value_in_data_table``, ``value_not_in_data_table``, ``dataset_ok_validator``, ``dataset_metadata_in_range``]]> @@ -5604,12 +5605,12 @@ A tool can refer multiple reference IDs. ```xml - + seqtk ``` - + ]]> @@ -5619,7 +5620,7 @@ A tool can refer multiple reference IDs. - The ``xref`` element specifies reference + The ``xref`` element specifies reference information according to a catalog. diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index e87c9542b2b..682512d55c6 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -84,6 +84,13 @@ class ToolParameter(Dictifiable): Describes a parameter accepted by a tool. This is just a simple stub at the moment but in the future should encapsulate more complex parameters (lists of valid choices, validation logic, ...) + + >>> from galaxy.util.bunch import Bunch + >>> trans = Bunch(app=None) + >>> p = TextToolParameter(None, XML('')) + >>> print(p.name) + parameter_name + >>> assert sorted(p.to_dict(trans).items()) == [('area', False), ('argument', '--parameter-name'), ('datalist', []), ('help', ''), ('hidden', False), ('is_dynamic', False), ('label', ''), ('model_class', 'TextToolParameter'), ('name', 'parameter_name'), ('optional', False), ('refresh_on_change', False), ('type', 'text'), ('value', 'default')] """ dict_collection_visible_keys = ['name', 'argument', 'type', 'label', 'help', 'refresh_on_change'] @@ -250,7 +257,7 @@ class ToolParameter(Dictifiable): if name is None: argument = input_source.get('argument') if argument: - name = argument.lstrip('-') + name = argument.lstrip('-').replace("-", "_") else: raise ValueError("parameter must specify a name.") return name