Skip to content

Commit

Permalink
Small refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Dec 17, 2024
1 parent 9889fa4 commit 0a5a9bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,12 @@ def value_from_basic(self, value, app, ignore_errors=False):
elif isinstance(value, MutableMapping) and value.get("__class__") == "UnvalidatedValue":
return value["value"]
# Delegate to the 'to_python' method
if ignore_errors:
try:
return self.to_python(value, app)
except Exception:
return value
else:
try:
return self.to_python(value, app)
except Exception:
if not ignore_errors:
raise
return value

def value_to_display_text(self, value) -> str:
if is_runtime_value(value):
Expand Down
16 changes: 8 additions & 8 deletions lib/galaxy/tools/parameters/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ def value_from_basic(self, value, app, ignore_errors=False):
else:
rval_dict[input.name] = input.value_from_basic(d[input.name], app, ignore_errors)
rval.append(rval_dict)
except Exception as e:
except Exception:
if not ignore_errors:
raise e
raise
return rval

def get_initial_value(self, trans, context):
Expand Down Expand Up @@ -226,9 +226,9 @@ def value_from_basic(self, value, app, ignore_errors=False):
for input in self.inputs.values():
if not ignore_errors or input.name in value:
rval[input.name] = input.value_from_basic(value[input.name], app, ignore_errors)
except Exception as e:
except Exception:
if not ignore_errors:
raise e
raise
return rval

def get_initial_value(self, trans, context):
Expand Down Expand Up @@ -389,9 +389,9 @@ def value_from_basic(self, value, app, ignore_errors=False):
else:
rval_dict[input.name] = input.value_from_basic(d[input.name], app, ignore_errors)
rval.append(rval_dict)
except Exception as e:
except Exception:
if not ignore_errors:
raise e
raise
return rval

def get_file_count(self, trans, context):
Expand Down Expand Up @@ -794,9 +794,9 @@ def value_from_basic(self, value, app, ignore_errors=False):
# conditional's values dictionary.
if not ignore_errors or input.name in value:
rval[input.name] = input.value_from_basic(value[input.name], app, ignore_errors)
except Exception as e:
except Exception:
if not ignore_errors:
raise e
raise
return rval

def get_initial_value(self, trans, context):
Expand Down

0 comments on commit 0a5a9bc

Please sign in to comment.