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

Type updates #12868

Merged
merged 6 commits into from
Nov 11, 2021
Merged

Type updates #12868

merged 6 commits into from
Nov 11, 2021

Conversation

mr-c
Copy link
Contributor

@mr-c mr-c commented Nov 8, 2021

Why: common-workflow-lab#137
What: Improved type hints

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

@mr-c mr-c marked this pull request as ready for review November 9, 2021 17:22
@github-actions github-actions bot added this to the 22.01 milestone Nov 9, 2021
@mr-c mr-c force-pushed the type_updates branch 5 times, most recently from fb42185 to dae7318 Compare November 9, 2021 19:17
disallow_untyped_decorators = True
no_implicit_optional = True
warn_unused_ignores = True
warn_return_any = True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If warn_return_any = True is specified under [mypy-galaxy.tools.wrappers] then tox -e test_galaxy_packages fails

https://app.circleci.com/pipelines/github/galaxyproject/galaxy/19036/workflows/9cc3867a-c0f9-4d2e-8876-9a49ed4e54a6/jobs/156058?invite=true#step-104-2353

mypy galaxy tests
galaxy/tools/wrappers.py:262: error: Returning Any from function declared to return "Iterator[Any]"
galaxy/tools/wrappers.py:265: error: Returning Any from function declared to return "bool"
galaxy/tools/wrappers.py:346: error: Returning Any from function declared to return "List[Tuple[str, str]]"
galaxy/tools/wrappers.py:365: error: Returning Any from function declared to return "bool"
galaxy/tools/wrappers.py:573: error: Returning Any from function declared to return "List[List[Any]]"

but tox -e py36-mypy passes

Copy link
Contributor

@davelopez davelopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all the type annotations! I learned a couple of things from it :)

lib/galaxy/datatypes/binary.py Show resolved Hide resolved
lib/galaxy/tools/wrappers.py Outdated Show resolved Hide resolved
lib/galaxy/tools/wrappers.py Outdated Show resolved Hide resolved
lib/galaxy/workflow/modules.py Outdated Show resolved Hide resolved
@mr-c mr-c force-pushed the type_updates branch 2 times, most recently from bdc5fc8 to 14df18a Compare November 10, 2021 14:22
Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

lib/galaxy/tools/wrappers.py Outdated Show resolved Hide resolved
@mr-c mr-c mentioned this pull request Nov 10, 2021
3 tasks
mr-c and others added 6 commits November 11, 2021 11:55
lib/galaxy/workflow/run.py:333: error: Item "DatasetCollection" of "Union[HistoryDatasetCollectionAssociation, DatasetCollection]" has no attribute "collection"
The code wouldn't currently work if `replacement` is a `DatasetCollection`
because it tries to access the `collection` attribute which is
available only for `HistoryDatasetCollectionAssociation`.
@nsoranzo nsoranzo merged commit b8f0cbc into galaxyproject:dev Nov 11, 2021
@nsoranzo nsoranzo deleted the type_updates branch November 11, 2021 13:15
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.

5 participants