Skip to content

Cleanup mypy_test.py #7738

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

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Cleanup mypy_test.py #7738

merged 1 commit into from
Apr 28, 2022

Conversation

AlexWaygood
Copy link
Member

I am planning a second PR after this one, to add new functionality to mypy_test.py so that it runs on files in the tests and test_cases directories.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

One question, but feel free to merge

@@ -76,7 +74,7 @@ def parse_versions(fname):
continue
m = _VERSION_LINE_RE.match(line)
assert m, "invalid VERSIONS line: " + line
mod = m.group(1)
mod: str = m.group(1)
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, why is this necessary?

Copy link
Member Author

@AlexWaygood AlexWaygood Apr 28, 2022

Choose a reason for hiding this comment

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

I was running mypy with --strict on this file, and it correctly pointed out that, strictly speaking, mod here could be Any due to this overload:

def group(self, __group: str | int) -> AnyStr | Any: ...

That then causes issues here due to --warn-any-return, which is part of --strict.

@AlexWaygood AlexWaygood merged commit 002c8e2 into python:master Apr 28, 2022
@AlexWaygood AlexWaygood deleted the mypy-test branch April 28, 2022 18:00
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.

2 participants