Mercurial > repos > fubar > tool_factory_2
diff toolfactory/galaxyxml/tool/parameters/__init__.py @ 38:a30536c100bf draft
Updated history outputs
author | fubar |
---|---|
date | Wed, 12 Aug 2020 01:43:46 -0400 |
parents | ce2b1f8ea68d |
children |
line wrap: on
line diff
--- a/toolfactory/galaxyxml/tool/parameters/__init__.py Mon Aug 10 23:25:51 2020 -0400 +++ b/toolfactory/galaxyxml/tool/parameters/__init__.py Wed Aug 12 01:43:46 2020 -0400 @@ -1,7 +1,10 @@ +from builtins import object from builtins import str -from builtins import object + +from galaxyxml import Util + from lxml import etree -from galaxyxml import Util + class XMLParam(object): @@ -23,13 +26,11 @@ self.children.append(sub_node) else: raise Exception( - "Child was unacceptable to parent (%s is not appropriate for %s)" - % (type(self), type(sub_node)) + "Child was unacceptable to parent (%s is not appropriate for %s)" % (type(self), type(sub_node)) ) else: raise Exception( - "Child was unacceptable to parent (%s is not appropriate for %s)" - % (type(self), type(sub_node)) + "Child was unacceptable to parent (%s is not appropriate for %s)" % (type(self), type(sub_node)) ) def validate(self): @@ -155,9 +156,7 @@ # This bodes to be an issue -__- def acceptable_child(self, child): - return issubclass(type(child), Requirement) or issubclass( - type(child), Container - ) + return issubclass(type(child), Requirement) or issubclass(type(child), Container) class Requirement(XMLParam): @@ -187,9 +186,7 @@ name = "configfiles" def acceptable_child(self, child): - return issubclass(type(child), Configfile) or issubclass( - type(child), ConfigfileDefaultInputs - ) + return issubclass(type(child), Configfile) or issubclass(type(child), ConfigfileDefaultInputs) class Configfile(XMLParam): @@ -217,15 +214,7 @@ name = "inputs" # This bodes to be an issue -__- - def __init__( - self, - action=None, - check_value=None, - method=None, - target=None, - nginx_upload=None, - **kwargs, - ): + def __init__(self, action=None, check_value=None, method=None, target=None, nginx_upload=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(Inputs, self).__init__(**params) @@ -262,9 +251,7 @@ # TODO: replace with positional attribute if len(self.flag()) > 0: if kwargs["label"] is None: - kwargs[ - "label" - ] = "Author did not provide help for this parameter... " + kwargs["label"] = "Author did not provide help for this parameter... " if not self.positional: kwargs["argument"] = self.flag() @@ -297,11 +284,7 @@ if self.positional: return self.mako_name() else: - return "%s%s%s" % ( - self.flag(), - self.space_between_arg, - self.mako_name(), - ) + return "%s%s%s" % (self.flag(), self.space_between_arg, self.mako_name()) def mako_name(self): # TODO: enhance logic to check up parents for things like @@ -353,9 +336,7 @@ super(Conditional, self).__init__(**params) def acceptable_child(self, child): - return issubclass(type(child), InputParameter) and not isinstance( - child, Conditional - ) + return issubclass(type(child), InputParameter) and not isinstance(child, Conditional) def validate(self): # Find a way to check if one of the kids is a WHEN @@ -383,22 +364,16 @@ super(Param, self).__init__(**params) if type(self) == Param: - raise Exception( - "Param class is not an actual parameter type, use a subclass of Param" - ) + raise Exception("Param class is not an actual parameter type, use a subclass of Param") def acceptable_child(self, child): - return issubclass( - type(child, InputParameter) or isinstance(child), ValidatorParam - ) + return issubclass(type(child, InputParameter) or isinstance(child), ValidatorParam) class TextParam(Param): type = "text" - def __init__( - self, name, optional=None, label=None, help=None, value=None, **kwargs - ): + def __init__(self, name, optional=None, label=None, help=None, value=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(TextParam, self).__init__(**params) @@ -413,17 +388,7 @@ class _NumericParam(Param): - def __init__( - self, - name, - value, - optional=None, - label=None, - help=None, - min=None, - max=None, - **kwargs, - ): + def __init__(self, name, value, optional=None, label=None, help=None, min=None, max=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(_NumericParam, self).__init__(**params) @@ -440,15 +405,7 @@ type = "boolean" def __init__( - self, - name, - optional=None, - label=None, - help=None, - checked=False, - truevalue=None, - falsevalue=None, - **kwargs, + self, name, optional=None, label=None, help=None, checked=False, truevalue=None, falsevalue=None, **kwargs ): params = Util.clean_kwargs(locals().copy()) @@ -477,16 +434,7 @@ class DataParam(Param): type = "data" - def __init__( - self, - name, - optional=None, - label=None, - help=None, - format=None, - multiple=None, - **kwargs, - ): + def __init__(self, name, optional=None, label=None, help=None, format=None, multiple=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(DataParam, self).__init__(**params) @@ -505,7 +453,7 @@ multiple=None, options=None, default=None, - **kwargs, + **kwargs ): params = Util.clean_kwargs(locals().copy()) del params["options"] @@ -544,14 +492,7 @@ class Options(InputParameter): name = "options" - def __init__( - self, - from_dataset=None, - from_file=None, - from_data_table=None, - from_parameter=None, - **kwargs, - ): + def __init__(self, from_dataset=None, from_file=None, from_data_table=None, from_parameter=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(Options, self).__init__(None, **params) @@ -583,7 +524,7 @@ value=None, ref_attribute=None, index=None, - **kwargs, + **kwargs ): params = Util.clean_kwargs(locals().copy()) super(Filter, self).__init__(**params) @@ -602,7 +543,7 @@ line_startswith=None, min=None, max=None, - **kwargs, + **kwargs ): params = Util.clean_kwargs(locals().copy()) super(ValidatorParam, self).__init__(**params) @@ -630,7 +571,7 @@ label=None, from_work_dir=None, hidden=False, - **kwargs, + **kwargs ): # TODO: validate format_source&metadata_source against something in the # XMLParam children tree. @@ -659,11 +600,7 @@ return flag + self.mako_identifier def acceptable_child(self, child): - return ( - isinstance(child, OutputFilter) - or isinstance(child, ChangeFormat) - or isinstance(child, DiscoverDatasets) - ) + return isinstance(child, OutputFilter) or isinstance(child, ChangeFormat) or isinstance(child, DiscoverDatasets) class OutputFilter(XMLParam): @@ -713,25 +650,19 @@ type_source=None, structured_like=None, inherit_format=None, - **kwargs, + **kwargs ): params = Util.clean_kwargs(locals().copy()) super(OutputCollection, self).__init__(**params) def acceptable_child(self, child): - return ( - isinstance(child, OutputData) - or isinstance(child, OutputFilter) - or isinstance(child, DiscoverDatasets) - ) + return isinstance(child, OutputData) or isinstance(child, OutputFilter) or isinstance(child, DiscoverDatasets) class DiscoverDatasets(XMLParam): name = "discover_datasets" - def __init__( - self, pattern, directory=None, format=None, ext=None, visible=None, **kwargs - ): + def __init__(self, pattern, directory=None, format=None, ext=None, visible=None, **kwargs): params = Util.clean_kwargs(locals().copy()) super(DiscoverDatasets, self).__init__(**params) @@ -773,7 +704,7 @@ compare=None, lines_diff=None, delta=None, - **kwargs, + **kwargs ): params = Util.clean_kwargs(locals().copy()) super(TestOutput, self).__init__(**params)