Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Don't fail if reporting invalid parameter values #18002

Merged

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Apr 16, 2024

which can contain None values.
Fixes the following traceback:

TypeError: sequence item 0: expected str instance, NoneType found
  File "galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/api/tools.py", line 247, in build
    return tool.to_json(trans, kwd.get("inputs", kwd), history=history)
  File "galaxy/tools/__init__.py", line 2509, in to_json
    populate_state(request_context, self.inputs, params.__dict__, state_inputs, state_errors)
  File "galaxy/tools/parameters/__init__.py", line 412, in populate_state
    _populate_state_legacy(
  File "galaxy/tools/parameters/__init__.py", line 625, in _populate_state_legacy
    check_param(request_context, input, param_value, context, simple_errors=simple_errors)
  File "galaxy/tools/parameters/__init__.py", line 246, in check_param
    value = param.from_json(value, trans, param_values)
  File "galaxy/tools/parameters/basic.py", line 1045, in from_json
    f"invalid options ({','.join(set(value) - set(legal_values))!r}) were selected (valid options: {','.join(legal_values)})",

Where None was in values. Note also that pyright underlined these lines, not sure why mypy has ignored this error.

Partial fix for #18001

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

which can contain None values.
Fixes the following traceback:
```
TypeError: sequence item 0: expected str instance, NoneType found
  File "galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/api/tools.py", line 247, in build
    return tool.to_json(trans, kwd.get("inputs", kwd), history=history)
  File "galaxy/tools/__init__.py", line 2509, in to_json
    populate_state(request_context, self.inputs, params.__dict__, state_inputs, state_errors)
  File "galaxy/tools/parameters/__init__.py", line 412, in populate_state
    _populate_state_legacy(
  File "galaxy/tools/parameters/__init__.py", line 625, in _populate_state_legacy
    check_param(request_context, input, param_value, context, simple_errors=simple_errors)
  File "galaxy/tools/parameters/__init__.py", line 246, in check_param
    value = param.from_json(value, trans, param_values)
  File "galaxy/tools/parameters/basic.py", line 1045, in from_json
    f"invalid options ({','.join(set(value) - set(legal_values))!r}) were selected (valid options: {','.join(legal_values)})",
```
Where `None` was in values. Note also that pyright underlined these
lines, not sure why mypy has ignored this error.
@mvdbeek mvdbeek merged commit 1c899ab into galaxyproject:release_24.0 Apr 17, 2024
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants