Skip to content

Commit

Permalink
fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Jul 30, 2023
1 parent 5c050ce commit af7e8b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def validate(self, value, trans=None):
try:
validator.validate(value, trans)
except ValueError as e:
raise ValueError(f"Parameter {self.name}: {e}") from None
raise ValueError(f"Parameter {self.name}: {e}") from None

def to_dict(self, trans, other_values=None):
"""to_dict tool parameter. This can be overridden by subclasses."""
Expand Down Expand Up @@ -1998,7 +1998,6 @@ def do_validate(v):
except ValueError as e:
raise ValueError(f"Parameter {self.name}: {e}") from None


dataset_count = 0
if value:
if self.multiple:
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/tools/parameters/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
log = logging.getLogger(__name__)



class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
Expand Down
8 changes: 4 additions & 4 deletions test/unit/app/tools/test_parameter_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ def test_RegexValidator(self):
p.validate("Foo")
p.validate("foo")
with self.assertRaisesRegex(
ValueError, "Parameter blah: Value 'Fop' does not match regular expression '\[Ff\]oo'"
ValueError, r"Parameter blah: Value 'Fop' does not match regular expression '\[Ff\]oo'"
):
p.validate("Fop")

# test also valitation of lists (for select parameters)
p.validate(["Foo", "foo"])
with self.assertRaisesRegex(
ValueError, "Parameter blah: Value 'Fop' does not match regular expression '\[Ff\]oo'"
ValueError, r"Parameter blah: Value 'Fop' does not match regular expression '\[Ff\]oo'"
):
p.validate(["Foo", "Fop"])

Expand Down Expand Up @@ -243,7 +243,7 @@ def test_DatasetOkValidator(self):
):
p.validate(notok_hda)
p = self._parameter_for(
xml="""
xml="""
<param name="blah" type="data" no_validation="true">
<validator type="dataset_ok_validator" negate="true"/>
</param>"""
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_MetadataValidator(self):
):
p.validate(hda)

param_xml_negate = """
param_xml_negate = """
<param name="blah" type="data">
<validator type="metadata" check="{check}" skip="{skip}" negate="true"/>
</param>"""
Expand Down

0 comments on commit af7e8b2

Please sign in to comment.