-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ruff-0.10] [flake8-pyi] Stabilize preview-mode behaviours for custom-type-var-for-self(PYI019)
#16607
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
Conversation
…tom-type-var-for-self` (`PYI019`)
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PYI019 | 19 | 19 | 0 | 0 | 0 |
Linter (preview)
✅ ecosystem check detected no linter changes.
|
The ecosystem hits all LGTM |
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
| /// | ||
| /// [PEP 673]: https://peps.python.org/pep-0673/#motivation | ||
| /// [PEP 695]: https://peps.python.org/pep-0695/ | ||
| /// [PEP-695]: https://peps.python.org/pep-0695/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update both PEP names. It feels somewhat inconsistent to use a - here but not for PEP 673 (I don't think we have a standard for this but I suspect that no dash is more commonly used?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this PEP-695 is only used in a hyphenated expression ([PEP-695]-style), which probably explains the extra dash in this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, Brent has it exactly right. The unhyphenated form is usually preferred, so that's why "PEP 673" should remain unhyphenated in the docs above this. But PEP-695-style is a hyphenated expression, so it makes sense for the hyphen to remain there between "PEP" and "695"
…tom-type-var-for-self`(`PYI019`) (#16607) ## Summary This PR stabilizes several preview-only behaviours for `custom-typevar-for-self` (`PYI019`). Namely: - A new, more accurate technique is now employed for detecting custom TypeVars that are replaceable with `Self`. See #15888 for details. - The range of the diagnostic is now the full function header rather than just the return annotation. (Previously, the rule only applied to methods with return annotations, but this is no longer true due to the changes in the first bullet point.) - The fix is now available even when preview mode is not enabled. ## Test Plan - Existing snapshots that do not have preview mode enabled are updated - Preview-specific snapshots are removed - I'll check the ecosystem report on this PR to verify everything's as expected
…tom-type-var-for-self`(`PYI019`) (#16607) ## Summary This PR stabilizes several preview-only behaviours for `custom-typevar-for-self` (`PYI019`). Namely: - A new, more accurate technique is now employed for detecting custom TypeVars that are replaceable with `Self`. See #15888 for details. - The range of the diagnostic is now the full function header rather than just the return annotation. (Previously, the rule only applied to methods with return annotations, but this is no longer true due to the changes in the first bullet point.) - The fix is now available even when preview mode is not enabled. ## Test Plan - Existing snapshots that do not have preview mode enabled are updated - Preview-specific snapshots are removed - I'll check the ecosystem report on this PR to verify everything's as expected
Summary
This PR stabilizes several preview-only behaviours for
custom-typevar-for-self(PYI019). Namely:Self. See [flake8-pyi] Significantly improve accuracy ofPYI019if preview mode is enabled #15888 for details.Test Plan