Skip to content

dmypy suggest can now suggest through contextmanager-based decorators #18948

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
May 2, 2025

Conversation

asottile
Copy link
Contributor

No description provided.

@asottile asottile force-pushed the mypy-suggest-contextmanager branch from 737c5ac to 0db2c46 Compare April 21, 2025 17:31
@asottile asottile force-pushed the mypy-suggest-contextmanager branch from 0db2c46 to f921981 Compare April 21, 2025 17:49
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

vision (https://github.com/pytorch/vision)
+ torchvision/utils.py:271: error: Unused "type: ignore" comment  [unused-ignore]

asottile-sentry added a commit to getsentry/sentry that referenced this pull request Apr 22, 2025
first commit automated via
https://github.com/getsentry/auto-type-annotate

- I used these patches to mypy:
    - python/mypy#18948
- (the line mentioned in the issue commented out):
python/mypy#18940 (comment)
- and with this unreverted (coming soon!):
#89854

<!-- Describe your PR here. -->
andrewshie-sentry pushed a commit to getsentry/sentry that referenced this pull request Apr 22, 2025
first commit automated via
https://github.com/getsentry/auto-type-annotate

- I used these patches to mypy:
    - python/mypy#18948
- (the line mentioned in the issue commented out):
python/mypy#18940 (comment)
- and with this unreverted (coming soon!):
#89854

<!-- Describe your PR here. -->
Copy link
Collaborator

@sterliakov sterliakov left a comment

Choose a reason for hiding this comment

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

Okay, the change looks good, but how come modifying the suggestions engine results in a primer hit? We don't run dmypy suggest with primer...

@asottile
Copy link
Contributor Author

asottile commented May 2, 2025

Okay, the change looks good, but how come modifying the suggestions engine results in a primer hit? We don't run dmypy suggest with primer...

pretty sure it's a race of another unrelated patch being merged and the use of workflow_run trigger using an unrelated base branch. a trivial rebase would probably remove the primer output I imagine

@hauntsaninja
Copy link
Collaborator

I think mypy is nondeterministic on torchvision, see hauntsaninja/mypy_primer#161

mypy_primer uses the merge base on PRs, so the diff should be trustworthy

Copy link
Collaborator

@hauntsaninja hauntsaninja 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 the fix!

@hauntsaninja hauntsaninja merged commit 43e8130 into python:master May 2, 2025
18 checks passed
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.

3 participants