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

fix: use mypy.ignore_missing_imports instead of suppressing them everywhere manually #238

Merged

Conversation

yedpodtrzitko
Copy link
Collaborator

@yedpodtrzitko yedpodtrzitko commented Jul 22, 2022

seems like these mypy errors are the last thing making the pipeline fail in #225. Instead of adding type: ignore to all newly added imports there, it would be better to disable these errors in one place. This PR is doing that.

ignore_missing_imports description in mypy docs:
https://mypy.readthedocs.io/en/stable/config_file.html#confval-ignore_missing_imports

  • config options are moved into its config file instead of calling them manually

@yedpodtrzitko yedpodtrzitko force-pushed the yed/mypy-ignore-missing-imports branch from b5970c2 to cc84ea7 Compare July 22, 2022 04:18
@@ -194,7 +194,8 @@ def validate(
before(request, response, req_validation_error, None)
if req_validation_error:
after(request, response, req_validation_error, None)
abort(response) # type: ignore
assert response # make mypy happy
abort(response)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was weird. Removing type: ignore here passed when running it on my machine, but it was raising error when running here. When I put it back, it was complaining about unused ignore. So the way how to oveercome it was to make sure the response is not Optional.

Copy link
Member

Choose a reason for hiding this comment

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

Sometimes that happens even if the Python and mypy versions are the same. I'm not sure about the root cause.

Copy link
Member

@kemingy kemingy left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! 🎉

@kemingy kemingy enabled auto-merge (squash) July 22, 2022 04:41
@kemingy kemingy merged commit 278f1bd into 0b01001001:master Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants