argument tag: replace dashes by underscores

This commit is contained in:
M Bernt
2019-08-19 10:46:56 +02:00
parent fbcb703814
commit a7e49048e6
2 changed files with 18 additions and 10 deletions
+10 -9
View File
@@ -187,7 +187,7 @@ automatically if profile is set to any version newer than ``16.01``, such as
<xs:annotation>
<xs:documentation xml:lang="en">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.</xs:documentation>
</xs:annotation>
@@ -1788,7 +1788,7 @@ statement. A good example tool that demonstrates many conditional parameters is
</param>
<when value="tsv">
<param name="input_table" type="data" format="tabular" label="Tabular File" argument="--input-fp"/>
<param name="process_obs_metadata" type="select" label="Process metadata associated with observations when converting" argument="--process-obs-metadata">
<param type="select" label="Process metadata associated with observations when converting" argument="--process-obs-metadata">
<option value="" selected="true">Do Not process metadata</option>
<option value="taxonomy">taxonomy</option>
<option value="naive">naive</option>
@@ -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).
]]></xs:documentation>
</xs:annotation>
@@ -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``]]></xs:documentation>
@@ -5604,12 +5605,12 @@ A tool can refer multiple reference IDs.
```xml
<!-- Example: this tool is seqtk -->
<xrefs>
<xrefs>
<xref type="bio.tools">seqtk</xref>
</xrefs>
<!-- https://bio.tools/seqtk -->
```
]]></xs:documentation>
</xs:annotation>
<xs:sequence>
@@ -5619,7 +5620,7 @@ A tool can refer multiple reference IDs.
</xs:complexType>
<xs:complexType name="xref">
<xs:annotation>
<xs:documentation xml:lang="en">The ``xref`` element specifies reference
<xs:documentation xml:lang="en">The ``xref`` element specifies reference
information according to a catalog.</xs:documentation>
</xs:annotation>
<xs:simpleContent>
+8 -1
View File
@@ -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('<param argument="--parameter-name" type="text" value="default" />'))
>>> 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