From 6846fa4a57bd62ba22c4634600ef374c7d951e5c Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 22 Jul 2020 11:36:36 -0400 Subject: [PATCH 1/9] initial Galaxy support --- acclimatise/__init__.py | 1 + acclimatise/cli.py | 6 +-- acclimatise/converter/galaxy.py | 74 ++++++++++++++++++++++++++++++--- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/acclimatise/__init__.py b/acclimatise/__init__.py index b7886a6..6943ef2 100644 --- a/acclimatise/__init__.py +++ b/acclimatise/__init__.py @@ -9,6 +9,7 @@ from acclimatise.converter import WrapperGenerator from acclimatise.converter.cwl import CwlGenerator +from acclimatise.converter.galaxy import GalaxyGenerator from acclimatise.converter.wdl import WdlGenerator from acclimatise.converter.yml import YmlGenerator from acclimatise.execution import execute_cmd diff --git a/acclimatise/cli.py b/acclimatise/cli.py index 16c19b3..4881bc7 100644 --- a/acclimatise/cli.py +++ b/acclimatise/cli.py @@ -63,9 +63,9 @@ def main(): "--format", "-f", "formats", - type=click.Choice(["wdl", "cwl", "yml"]), + type=click.Choice(["wdl", "cwl", "yml", "galaxy"]), multiple=True, - default=("yml", "wdl", "cwl"), + default=("yml", "wdl", "cwl", "galaxy"), help="The language in which to output the CLI wrapper", ) @click.option( @@ -123,7 +123,7 @@ def explore( @click.option( "--format", "-f", - type=click.Choice(["wdl", "cwl", "yml"]), + type=click.Choice(["wdl", "cwl", "yml", "galaxy"]), default="cwl", help="The language in which to output the CLI wrapper", ) diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index ae09127..6bab366 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -5,6 +5,9 @@ from pathlib import Path from typing import Generator, List +import galaxyxml.tool as gxt +import galaxyxml.tool.parameters as gxtp + from dataclasses import dataclass from acclimatise import cli_types @@ -25,14 +28,75 @@ def format(cls) -> str: def suffix(self) -> str: return ".xml" + @staticmethod + def to_gxy_class(typ: cli_types.CliType): + if isinstance(typ, cli_types.CliFile): + return gxtp.DataParam + elif isinstance(typ, cli_types.CliDir): + return gxtp.DataParam # can make composite datatype + elif isinstance(typ, cli_types.CliString): + return gxtp.TextParam + elif isinstance(typ, cli_types.CliFloat): + return gxtp.FloatParam + elif isinstance(typ, cli_types.CliInteger): + return gxtp.IntegerParam + elif isinstance(typ, cli_types.CliBoolean): + return gxtp.BooleanParam + elif isinstance(typ, cli_types.CliEnum): + return gxtp.BooleanParam + #elif isinstance(typ, cli_types.CliList): + # return CwlGenerator.to_cwl_type(typ.value) + "[]" + #elif isinstance(typ, cli_types.CliTuple): + # return [CwlGenerator.to_cwl_type(subtype) for subtype in set(typ.values)] + else: + raise Exception(f"Invalid type {typ}!") + def save_to_string(self, cmd: Command) -> str: - # Todo - pass + # Some limits due to cmd data mondel?: + # No package name information + # No version information + # No outputs + + + inputs: List[CliArgument] = [*cmd.named] + ( + [] if self.ignore_positionals else [*cmd.positional] + ) + names = self.choose_variable_names(inputs) + + + tool_name = cmd.as_filename + tool_id = cmd.as_filename + tool_version = '0.0.1' + tool_description = '' + tool_executable = ' '.join(cmd.command) + version_command = "%s %s" % (tool_executable, cmd.version_flag) + tool = gxt.Tool(tool_name, tool_name, tool_version, tool_description, tool_executable, hidden=False, + tool_type=None, URL_method=None, workflow_compatible=True, + interpreter=None, version_command=version_command) + + # Does cmd have a concept of outputs? + tool.inputs = gxtp.Inputs() + tool.outputs = gxtp.Outputs() + tool.help = cmd.help_text + + # Add requirements + requirements = gxtp.Requirements() + requirements.append(gxtp.Requirement('package', tool_executable, version=None)) + tool.requirements = requirements + + for arg in names: + assert arg.name != "", arg + param_cls = self.to_gxy_class(arg.arg.get_type()) + param = param_cls(arg.name, label=arg.arg.description, positional=isinstance(arg.arg, Positional), + help=arg.arg.description, value=None, num_dashes=len(arg.arg.longest_synonym)-len(arg.arg.longest_synonym.lstrip('-')), + optional=arg.arg.optional) + tool.inputs.append(param) + return tool.export() def save_to_file(self, cmd: Command, path: Path) -> None: - # Todo - pass + with path.open("w") as fp: + fp.write(self.save_to_string(cmd)) @classmethod def validate(cls, wrapper: str, cmd: Command = None, explore=True): - pass + return True From 3c0e49baafbefcb437e2c3d7dbcf9a7e16263112 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 22 Jul 2020 22:34:10 +0200 Subject: [PATCH 2/9] run CI also on pull_request --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb087de..95e0d70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: -on: [push] +on: [push, pull_request] jobs: test_conda: From 47aa4f8fa021d9d24777f8608774ccf5d16e0f95 Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Fri, 24 Jul 2020 12:14:48 +1000 Subject: [PATCH 3/9] Remove cwlgen as dependency I can't see it being used in the repo, and it might cause other dependency issues as the project is deprecated. --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index c709212..b49eb46 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,6 @@ "pyparsing", "jinja2", "spacy", - "cwlgen", "miniwdl", "wordsegment", "inflection", From 1f2daa829486dd0e2c529511b8b620ccafe2ed51 Mon Sep 17 00:00:00 2001 From: Michael Milton Date: Fri, 24 Jul 2020 17:54:23 +1000 Subject: [PATCH 4/9] Only parse usage if the word usage is at the start of a line --- acclimatise/model.py | 7 +++++++ acclimatise/usage_parser/__init__.py | 2 +- acclimatise/usage_parser/elements.py | 6 ++++-- test/usage/test_usage.py | 8 ++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/acclimatise/model.py b/acclimatise/model.py index 53eb03a..cb753e0 100644 --- a/acclimatise/model.py +++ b/acclimatise/model.py @@ -78,6 +78,13 @@ def as_filename(self) -> str: """ return "_".join(self.command).replace("-", "_") + @property + def empty(self) -> bool: + """ + True if we think this command failed in parsing, ie it has no arguments + """ + return (len(self.positional) + len(self.named) + len(self.subcommands)) == 0 + @property def depth(self) -> int: """ diff --git a/acclimatise/usage_parser/__init__.py b/acclimatise/usage_parser/__init__.py index 37a754c..3b63391 100644 --- a/acclimatise/usage_parser/__init__.py +++ b/acclimatise/usage_parser/__init__.py @@ -16,7 +16,7 @@ def normalise_cline(tokens): return [Path(el.lower()).stem for el in tokens] -def parse_usage(cmd, text, debug=False): +def parse_usage(cmd, text, debug=False) -> Command: toks = usage.setDebug(debug).searchString(text) if not toks: # If we had no results, return an empty command diff --git a/acclimatise/usage_parser/elements.py b/acclimatise/usage_parser/elements.py index a91f0d6..8f5b048 100644 --- a/acclimatise/usage_parser/elements.py +++ b/acclimatise/usage_parser/elements.py @@ -181,8 +181,10 @@ def visit_usage(s, loc, toks): return toks[0][0] -usage = Regex("usage:", flags=re.IGNORECASE).suppress() + OneOrMore( - usage_element, stopOn=LineEnd() +usage = ( + LineStart() + + Regex("usage:", flags=re.IGNORECASE).suppress() + + OneOrMore(usage_element, stopOn=LineEnd()) ) # .setParseAction(visit_usage).setDebug() diff --git a/test/usage/test_usage.py b/test/usage/test_usage.py index 380b396..cb519f7 100644 --- a/test/usage/test_usage.py +++ b/test/usage/test_usage.py @@ -174,3 +174,11 @@ def test_samtools_dict(): """ command = parse_usage(["samtools", "dict"], text, debug=True) assert len(command.positional) == 1 + + +def test_mid_line_usage(): + text = """ + Can't open --usage: No such file or directory at /usr/bin/samtools.pl line 50. + """ + command = parse_usage(["samtools.pl", "showALEN"], text, debug=True) + assert command.empty From e9b66c9080b37380aedecc49dd2229bb6550484c Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 24 Jul 2020 07:17:07 -0400 Subject: [PATCH 5/9] merge --- acclimatise/__init__.py | 1 + acclimatise/converter/__init__.py | 2 +- acclimatise/converter/galaxy.py | 41 ++++++++++++++++++++++--------- setup.py | 1 + 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/acclimatise/__init__.py b/acclimatise/__init__.py index 6943ef2..6756288 100644 --- a/acclimatise/__init__.py +++ b/acclimatise/__init__.py @@ -12,6 +12,7 @@ from acclimatise.converter.galaxy import GalaxyGenerator from acclimatise.converter.wdl import WdlGenerator from acclimatise.converter.yml import YmlGenerator +from acclimatise.converter.galaxy import GalaxyGenerator from acclimatise.execution import execute_cmd from acclimatise.flag_parser.parser import CliParser from acclimatise.model import Command, Flag diff --git a/acclimatise/converter/__init__.py b/acclimatise/converter/__init__.py index 9666a13..6a75608 100644 --- a/acclimatise/converter/__init__.py +++ b/acclimatise/converter/__init__.py @@ -47,7 +47,7 @@ def choose_converter(cls, typ) -> Type["WrapperGenerator"]: if subclass.format() == typ: return subclass - raise Exception("Unknown format type") + raise Exception("Unknown format type %s" % typ) @classmethod @abstractmethod diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index 6bab366..b31fa73 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -15,6 +15,19 @@ from acclimatise.model import CliArgument, Command, Flag, Positional from acclimatise.yaml import yaml +from galaxyxml.tool import Tool +from galaxyxml.tool.parameters import ( + BooleanParam, + FloatParam, + Inputs, + IntegerParam, + Outputs, + Requirement, + Requirements, + Tests, + TextParam +) + @dataclass class GalaxyGenerator(WrapperGenerator): @@ -42,8 +55,8 @@ def to_gxy_class(typ: cli_types.CliType): return gxtp.IntegerParam elif isinstance(typ, cli_types.CliBoolean): return gxtp.BooleanParam - elif isinstance(typ, cli_types.CliEnum): - return gxtp.BooleanParam + #elif isinstance(typ, cli_types.CliEnum): + # return gxtp.BooleanParam #elif isinstance(typ, cli_types.CliList): # return CwlGenerator.to_cwl_type(typ.value) + "[]" #elif isinstance(typ, cli_types.CliTuple): @@ -69,7 +82,7 @@ def save_to_string(self, cmd: Command) -> str: tool_version = '0.0.1' tool_description = '' tool_executable = ' '.join(cmd.command) - version_command = "%s %s" % (tool_executable, cmd.version_flag) + version_command = "%s %s" % (tool_executable, cmd.version_flag.full_name()) tool = gxt.Tool(tool_name, tool_name, tool_version, tool_description, tool_executable, hidden=False, tool_type=None, URL_method=None, workflow_compatible=True, interpreter=None, version_command=version_command) @@ -87,16 +100,22 @@ def save_to_string(self, cmd: Command) -> str: for arg in names: assert arg.name != "", arg param_cls = self.to_gxy_class(arg.arg.get_type()) - param = param_cls(arg.name, label=arg.arg.description, positional=isinstance(arg.arg, Positional), - help=arg.arg.description, value=None, num_dashes=len(arg.arg.longest_synonym)-len(arg.arg.longest_synonym.lstrip('-')), - optional=arg.arg.optional) + # not yet handled: + # default values? + # ints & floats: min, max + param = param_cls(arg.name, + label=arg.arg.description, + positional=isinstance(arg.arg, Positional), + help=arg.arg.description, + value=None, + num_dashes=len(arg.arg.longest_synonym)-len(arg.arg.longest_synonym.lstrip('-')), + optional=arg.arg.optional) + # output or input? tool.inputs.append(param) return tool.export() - def save_to_file(self, cmd: Command, path: Path) -> None: - with path.open("w") as fp: - fp.write(self.save_to_string(cmd)) - @classmethod def validate(cls, wrapper: str, cmd: Command = None, explore=True): - return True + # Todo add planemo lint call + # probably calling the functions in this loop: https://github.com/galaxyproject/planemo/blob/2b659c9a7531f9a973e60d6319898e58ef3ea781/planemo/tool_lint.py#L28 + pass diff --git a/setup.py b/setup.py index c709212..f8b54a7 100755 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ "word2number", "psutil", "dataclasses", + "galaxyxml", ], python_requires=">=3.6", entry_points={"console_scripts": ["acclimatise = acclimatise.cli:main"]}, From f260f1acf1c032bb700d83d124fffff557a58eed Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 24 Jul 2020 07:22:57 -0400 Subject: [PATCH 6/9] cleanup imports --- acclimatise/converter/galaxy.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index b31fa73..8047457 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -15,19 +15,6 @@ from acclimatise.model import CliArgument, Command, Flag, Positional from acclimatise.yaml import yaml -from galaxyxml.tool import Tool -from galaxyxml.tool.parameters import ( - BooleanParam, - FloatParam, - Inputs, - IntegerParam, - Outputs, - Requirement, - Requirements, - Tests, - TextParam -) - @dataclass class GalaxyGenerator(WrapperGenerator): From 31dc6cd8ffe332389f2ec5b78e08f3f06e079306 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 24 Jul 2020 09:38:01 -0400 Subject: [PATCH 7/9] Format help text add linting for validation. --- acclimatise/converter/galaxy.py | 31 +++++++++++++++++++++++++------ setup.py | 1 + 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index 8047457..880eda8 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -8,6 +8,9 @@ import galaxyxml.tool as gxt import galaxyxml.tool.parameters as gxtp +from galaxy.tool_util.lint import lint_tool_source, LEVEL_ALL, LEVEL_WARN, LEVEL_ERROR +from galaxy.tool_util.parser import get_tool_source + from dataclasses import dataclass from acclimatise import cli_types @@ -52,7 +55,7 @@ def to_gxy_class(typ: cli_types.CliType): raise Exception(f"Invalid type {typ}!") def save_to_string(self, cmd: Command) -> str: - # Some limits due to cmd data mondel?: + # Some current limits?: # No package name information # No version information # No outputs @@ -74,10 +77,12 @@ def save_to_string(self, cmd: Command) -> str: tool_type=None, URL_method=None, workflow_compatible=True, interpreter=None, version_command=version_command) - # Does cmd have a concept of outputs? tool.inputs = gxtp.Inputs() tool.outputs = gxtp.Outputs() - tool.help = cmd.help_text + tool.help = self._format_help(cmd.help_text) + + tool.tests = gxtp.Tests() # ToDo: add tests + tool.citations = gxtp.Citations() # ToDo: add citations # Add requirements requirements = gxtp.Requirements() @@ -103,6 +108,20 @@ def save_to_string(self, cmd: Command) -> str: @classmethod def validate(cls, wrapper: str, cmd: Command = None, explore=True): - # Todo add planemo lint call - # probably calling the functions in this loop: https://github.com/galaxyproject/planemo/blob/2b659c9a7531f9a973e60d6319898e58ef3ea781/planemo/tool_lint.py#L28 - pass + # ToDo: Tests? What level to validate? + # Is wrapper assumed to be generated here, or should we also compare to result of output of save_to_string (as if wrapper was being generated externally) + # Raise value error if validation fails + with tempfile.NamedTemporaryFile(mode="w+", suffix=".xml") as fh: + fh.write(wrapper) + fh.flush() + tool_source = get_tool_source(config_file=fh.name) + if not lint_tool_source(tool_source, level=LEVEL_ALL, fail_level=LEVEL_WARN): + raise ValueError("Linting Failed") + return True + + def _format_help(self, help_text): + # Just cheat and make it a huge block quote + rval = "::\n" + for line in help_text.split('\n'): + rval = "%s\n %s" % (rval, line.rstrip()) + return "%s\n\n" % (rval) diff --git a/setup.py b/setup.py index 2ea337a..8c1c60a 100755 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ "psutil", "dataclasses", "galaxyxml", + "galaxy-tool-util" ], python_requires=">=3.6", entry_points={"console_scripts": ["acclimatise = acclimatise.cli:main"]}, From c232da3ea42879357041fafe6b0dc5eada8d9dd7 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 24 Jul 2020 09:50:51 -0400 Subject: [PATCH 8/9] remove extra import --- acclimatise/__init__.py | 1 - acclimatise/converter/galaxy.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/acclimatise/__init__.py b/acclimatise/__init__.py index 6756288..6943ef2 100644 --- a/acclimatise/__init__.py +++ b/acclimatise/__init__.py @@ -12,7 +12,6 @@ from acclimatise.converter.galaxy import GalaxyGenerator from acclimatise.converter.wdl import WdlGenerator from acclimatise.converter.yml import YmlGenerator -from acclimatise.converter.galaxy import GalaxyGenerator from acclimatise.execution import execute_cmd from acclimatise.flag_parser.parser import CliParser from acclimatise.model import Command, Flag diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index 880eda8..468154f 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -60,20 +60,18 @@ def save_to_string(self, cmd: Command) -> str: # No version information # No outputs - inputs: List[CliArgument] = [*cmd.named] + ( [] if self.ignore_positionals else [*cmd.positional] ) names = self.choose_variable_names(inputs) - tool_name = cmd.as_filename tool_id = cmd.as_filename tool_version = '0.0.1' tool_description = '' tool_executable = ' '.join(cmd.command) version_command = "%s %s" % (tool_executable, cmd.version_flag.full_name()) - tool = gxt.Tool(tool_name, tool_name, tool_version, tool_description, tool_executable, hidden=False, + tool = gxt.Tool(tool_name, tool_id, tool_version, tool_description, tool_executable, hidden=False, tool_type=None, URL_method=None, workflow_compatible=True, interpreter=None, version_command=version_command) From 8303e1382b4a8aff42b72bc5c320ce8138096b27 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 24 Jul 2020 12:35:26 -0400 Subject: [PATCH 9/9] reformat --- acclimatise/converter/galaxy.py | 61 ++++++++++++++++++++------------- setup.py | 2 +- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/acclimatise/converter/galaxy.py b/acclimatise/converter/galaxy.py index 468154f..5fa4bf5 100644 --- a/acclimatise/converter/galaxy.py +++ b/acclimatise/converter/galaxy.py @@ -5,18 +5,16 @@ from pathlib import Path from typing import Generator, List -import galaxyxml.tool as gxt -import galaxyxml.tool.parameters as gxtp - -from galaxy.tool_util.lint import lint_tool_source, LEVEL_ALL, LEVEL_WARN, LEVEL_ERROR -from galaxy.tool_util.parser import get_tool_source - from dataclasses import dataclass +import galaxyxml.tool as gxt +import galaxyxml.tool.parameters as gxtp from acclimatise import cli_types from acclimatise.converter import NamedArgument, WrapperGenerator from acclimatise.model import CliArgument, Command, Flag, Positional from acclimatise.yaml import yaml +from galaxy.tool_util.lint import LEVEL_ALL, LEVEL_ERROR, LEVEL_WARN, lint_tool_source +from galaxy.tool_util.parser import get_tool_source @dataclass @@ -36,7 +34,7 @@ def to_gxy_class(typ: cli_types.CliType): if isinstance(typ, cli_types.CliFile): return gxtp.DataParam elif isinstance(typ, cli_types.CliDir): - return gxtp.DataParam # can make composite datatype + return gxtp.DataParam # can make composite datatype elif isinstance(typ, cli_types.CliString): return gxtp.TextParam elif isinstance(typ, cli_types.CliFloat): @@ -45,11 +43,11 @@ def to_gxy_class(typ: cli_types.CliType): return gxtp.IntegerParam elif isinstance(typ, cli_types.CliBoolean): return gxtp.BooleanParam - #elif isinstance(typ, cli_types.CliEnum): + # elif isinstance(typ, cli_types.CliEnum): # return gxtp.BooleanParam - #elif isinstance(typ, cli_types.CliList): + # elif isinstance(typ, cli_types.CliList): # return CwlGenerator.to_cwl_type(typ.value) + "[]" - #elif isinstance(typ, cli_types.CliTuple): + # elif isinstance(typ, cli_types.CliTuple): # return [CwlGenerator.to_cwl_type(subtype) for subtype in set(typ.values)] else: raise Exception(f"Invalid type {typ}!") @@ -67,24 +65,34 @@ def save_to_string(self, cmd: Command) -> str: tool_name = cmd.as_filename tool_id = cmd.as_filename - tool_version = '0.0.1' - tool_description = '' - tool_executable = ' '.join(cmd.command) + tool_version = "0.0.1" + tool_description = "" + tool_executable = " ".join(cmd.command) version_command = "%s %s" % (tool_executable, cmd.version_flag.full_name()) - tool = gxt.Tool(tool_name, tool_id, tool_version, tool_description, tool_executable, hidden=False, - tool_type=None, URL_method=None, workflow_compatible=True, - interpreter=None, version_command=version_command) + tool = gxt.Tool( + tool_name, + tool_id, + tool_version, + tool_description, + tool_executable, + hidden=False, + tool_type=None, + URL_method=None, + workflow_compatible=True, + interpreter=None, + version_command=version_command, + ) tool.inputs = gxtp.Inputs() tool.outputs = gxtp.Outputs() tool.help = self._format_help(cmd.help_text) - tool.tests = gxtp.Tests() # ToDo: add tests - tool.citations = gxtp.Citations() # ToDo: add citations + tool.tests = gxtp.Tests() # ToDo: add tests + tool.citations = gxtp.Citations() # ToDo: add citations # Add requirements requirements = gxtp.Requirements() - requirements.append(gxtp.Requirement('package', tool_executable, version=None)) + requirements.append(gxtp.Requirement("package", tool_executable, version=None)) tool.requirements = requirements for arg in names: @@ -93,13 +101,16 @@ def save_to_string(self, cmd: Command) -> str: # not yet handled: # default values? # ints & floats: min, max - param = param_cls(arg.name, + param = param_cls( + arg.name, label=arg.arg.description, positional=isinstance(arg.arg, Positional), help=arg.arg.description, value=None, - num_dashes=len(arg.arg.longest_synonym)-len(arg.arg.longest_synonym.lstrip('-')), - optional=arg.arg.optional) + num_dashes=len(arg.arg.longest_synonym) + - len(arg.arg.longest_synonym.lstrip("-")), + optional=arg.arg.optional, + ) # output or input? tool.inputs.append(param) return tool.export() @@ -113,13 +124,15 @@ def validate(cls, wrapper: str, cmd: Command = None, explore=True): fh.write(wrapper) fh.flush() tool_source = get_tool_source(config_file=fh.name) - if not lint_tool_source(tool_source, level=LEVEL_ALL, fail_level=LEVEL_WARN): + if not lint_tool_source( + tool_source, level=LEVEL_ALL, fail_level=LEVEL_WARN + ): raise ValueError("Linting Failed") return True def _format_help(self, help_text): # Just cheat and make it a huge block quote rval = "::\n" - for line in help_text.split('\n'): + for line in help_text.split("\n"): rval = "%s\n %s" % (rval, line.rstrip()) return "%s\n\n" % (rval) diff --git a/setup.py b/setup.py index 8c1c60a..f43bb13 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ "psutil", "dataclasses", "galaxyxml", - "galaxy-tool-util" + "galaxy-tool-util", ], python_requires=">=3.6", entry_points={"console_scripts": ["acclimatise = acclimatise.cli:main"]},