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

Update Mypy to 1.11.2 and fix new signature override errors #18811

Merged
merged 8 commits into from
Sep 14, 2024

Conversation

nsoranzo
Copy link
Member

Extracted from #18578 , since it's going to be overwritten by the bot tomorrow.

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.

Fix the following mypy 1.11 error:
```
lib/galaxy/managers/history_contents.py:638: error: Signature of "_add_parsers"
incompatible with supertype "GenomeFilterMixin"  [override]
        def _add_parsers(self):
        ^
lib/galaxy/managers/history_contents.py:638: note:      Superclass:
lib/galaxy/managers/history_contents.py:638: note:          def _add_parsers(self, database_connection: str) -> Any
lib/galaxy/managers/history_contents.py:638: note:      Subclass:
lib/galaxy/managers/history_contents.py:638: note:          def _add_parsers(self) -> Any
```
…method

Fix the following mypy 1.11 errors:

```
lib/galaxy/managers/hdas.py:616: error: Signature of "serialize" incompatible
with supertype "DatasetAssociationSerializer"  [override]
        def serialize(self, hda, keys, user=None, **context):
        ^
lib/galaxy/managers/hdas.py:616: note:      Superclass:
lib/galaxy/managers/hdas.py:616: note:          def serialize(self, item: Any, keys: Any, **context: Any) -> Any
lib/galaxy/managers/hdas.py:616: note:      Subclass:
lib/galaxy/managers/hdas.py:616: note:          def serialize(self, hda: Any, keys: Any, user: Any = ..., **context: Any) -> Any
lib/galaxy/managers/hdas.py:616: error: Signature of "serialize" incompatible
with supertype "ModelSerializer"  [override]
        def serialize(self, hda, keys, user=None, **context):
        ^
lib/galaxy/managers/hdas.py:616: note:      Superclass:
lib/galaxy/managers/hdas.py:616: note:          def serialize(self, item: Any, keys: Any, **context: Any) -> Any
lib/galaxy/managers/hdas.py:616: note:      Subclass:
lib/galaxy/managers/hdas.py:616: note:          def serialize(self, hda: Any, keys: Any, user: Any = ..., **context: Any) -> Any
```
…ethod

Fix the following mypy 1.11 errors:

```
lib/galaxy/tools/__init__.py:3989: error: Signature of "produce_outputs"
incompatible with supertype "DatabaseOperationTool"  [override]
        def produce_outputs(self, trans, out_data, output_collections, inc...
        ^
lib/galaxy/tools/__init__.py:3989: note:      Superclass:
lib/galaxy/tools/__init__.py:3989: note:          def produce_outputs(self, trans: Any, out_data: Any, output_collections: Any, incoming: Any, history: Any, **kwds: Any) -> Any
lib/galaxy/tools/__init__.py:3989: note:      Subclass:
lib/galaxy/tools/__init__.py:3989: note:          def produce_outputs(self, trans: Any, out_data: Any, output_collections: Any, incoming: Any, history: Any, tag_handler: Any, **kwds: Any) -> Any
lib/galaxy/tools/__init__.py:4026: error: Signature of "produce_outputs"
incompatible with supertype "DatabaseOperationTool"  [override]
        def produce_outputs(self, trans, out_data, output_collections, inc...
        ^
lib/galaxy/tools/__init__.py:4026: note:      Superclass:
lib/galaxy/tools/__init__.py:4026: note:          def produce_outputs(self, trans: Any, out_data: Any, output_collections: Any, incoming: Any, history: Any, **kwds: Any) -> Any
lib/galaxy/tools/__init__.py:4026: note:      Subclass:
lib/galaxy/tools/__init__.py:4026: note:          def produce_outputs(self, trans: Any, out_data: Any, output_collections: Any, incoming: Any, history: Any, tag_handler: Any, **kwds: Any) -> Any
```
Fix the following mypy 1.11 errors:

```
lib/galaxy/workflow/modules.py:650: error: Signature of "save_to_step"
incompatible with supertype "WorkflowModule"  [override]
        def save_to_step(self, step, **kwd):
        ^
lib/galaxy/workflow/modules.py:650: note:      Superclass:
lib/galaxy/workflow/modules.py:650: note:          def save_to_step(self, step: Any, detached: Any = ...) -> Any
lib/galaxy/workflow/modules.py:650: note:      Subclass:
lib/galaxy/workflow/modules.py:650: note:          def save_to_step(self, step: Any, **kwd: Any) -> Any
lib/galaxy/workflow/modules.py:1030: error: Signature of "save_to_step"
incompatible with supertype "WorkflowModule"  [override]
        def save_to_step(self, step, **kwd):
        ^
lib/galaxy/workflow/modules.py:1030: note:      Superclass:
lib/galaxy/workflow/modules.py:1030: note:          def save_to_step(self, step: Any, detached: Any = ...) -> Any
lib/galaxy/workflow/modules.py:1030: note:      Subclass:
lib/galaxy/workflow/modules.py:1030: note:          def save_to_step(self, step: Any, **kwd: Any) -> Any
lib/galaxy/workflow/modules.py:1680: error: Signature of "save_to_step"
incompatible with supertype "WorkflowModule"  [override]
        def save_to_step(self, step, **kwd):
        ^
lib/galaxy/workflow/modules.py:1680: note:      Superclass:
lib/galaxy/workflow/modules.py:1680: note:          def save_to_step(self, step: Any, detached: Any = ...) -> Any
lib/galaxy/workflow/modules.py:1680: note:      Subclass:
lib/galaxy/workflow/modules.py:1680: note:          def save_to_step(self, step: Any, **kwd: Any) -> Any
```
Fix the following mypy 1.11 error:

```
lib/galaxy/tools/__init__.py:3212: error: Signature of "exec_after_process"
incompatible with supertype "Tool"  [override]
        def exec_after_process(self, app, inp_data, out_data, param_dict, ...
        ^
lib/galaxy/tools/__init__.py:3212: note:      Superclass:
lib/galaxy/tools/__init__.py:3212: note:          def exec_after_process(self, app: Any, inp_data: Any, out_data: Any, param_dict: Any, job: Any = ..., **kwds: Any) -> Any
lib/galaxy/tools/__init__.py:3212: note:      Subclass:
lib/galaxy/tools/__init__.py:3212: note:          def exec_after_process(self, app: Any, inp_data: Any, out_data: Any, param_dict: Any, job: Any, final_job_state: Any = ..., **kwds: Any) -> Any
```

Also:
- Add some type annotions
- Small refactorings
Remove now unneeded `type: ignore` .
@nsoranzo nsoranzo added kind/bug kind/refactoring cleanup or refactoring of existing code, no functional changes labels Sep 13, 2024
@github-actions github-actions bot added this to the 24.2 milestone Sep 13, 2024
@mvdbeek mvdbeek merged commit 948f38b into galaxyproject:dev Sep 14, 2024
55 of 56 checks passed
@nsoranzo nsoranzo deleted the mypy_1.11 branch September 14, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer area/dependencies area/jobs area/tool-framework area/util area/workflows kind/bug kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants