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

Enable reportUnnecessaryTypeIgnoreComment #487

Merged
merged 3 commits into from
Dec 29, 2022
Merged

Conversation

twoertwein
Copy link
Member

A potential alternative to #484.

If this PR gets merged:

  • pyright ignores any # type: ignore comments
  • if ignores are needed for pyright, use # pyright: ignore[...]
  • if there are not needed # pyright: ignore[...], pyright will let you know :)

Similar to python/typeshed@23ac9bf mypy ignores need to come before pyright ignores.

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

I like this idea of telling pyright to don't parse the # type: ignore comments. Then we know those are only there because of mypy

tests/test_frame.py Show resolved Hide resolved
@twoertwein twoertwein marked this pull request as ready for review December 29, 2022 18:56
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

thanks @twoertwein

Can you do a PR to update https://github.com/pandas-dev/pandas-stubs/blob/main/docs/philosophy.md to reflect how we are handling the ignore stuff, with respect to when we want to use the various ignore combinations, which I think are:

  1. Use only #type: ignore when mypy incorrectly says there is an error, but pyright correctly says there is no error
  2. Use only #pyright: ignore when mypy incorrectly says the code is OK, but pyright correctly finds an error
  3. Use both #type: ignore and #pyright: ignore only in the test code when doing TYPE_CHECKING_INVALID_USAGE
  4. Use both #type: ignore and #pyright: ignore in the PYI files when there are overlapping overloads that both type checkers detect

@Dr-Irv Dr-Irv merged commit 0b46778 into pandas-dev:main Dec 29, 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.

2 participants