-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[flake8-pyi
] Fix custom-typevar-for-self
with string annotations (PYI019
)
#18311
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
ntBre
merged 9 commits into
astral-sh:main
from
close2code-palm:fix/custom_tv_for_self_string
Jun 16, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2c7dcd3
[flake8-pyi] string typhints warning works same as for strait ones (P…
close2code-palm 4381158
[flake-pyi] snapshots update (PYI019)
close2code-palm 87c9e60
[flake-pyi] annotation normalization refactoring (PYI019)
close2code-palm 4ca6eca
Merge branch 'main' of https://github.com/astral-sh/ruff into fix/cus…
close2code-palm 99e8ffe
[flake-pyi] short circuits fix (PYI019)
close2code-palm a40fad6
Merge branch 'main' of https://github.com/astral-sh/ruff into fix/cus…
close2code-palm 6cd6a6c
Merge branch 'main' of https://github.com/astral-sh/ruff into fix/cus…
close2code-palm b2d8710
[flake-pyi] match simplification and extra filtration removed (PYI019)
close2code-palm b5dc72d
Merge branch 'main' of https://github.com/astral-sh/ruff into fix/cus…
close2code-palm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We may also need to adjust the replacement range. I don't think we want to replace
"_S"
with"Self"
. I think it should just be an unquotedSelf
.Uh oh!
There was an error while loading. Please reload this page.
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.
I tried to look around for the right way how to extend this behaviour but failed even with ugly approach. So, do we need this, as some other rule applies a fix to this moment right after, we just see "Self" in tests only related to this rule? I can't disagree that rule should do this on its own, but it will require more code changes and help from others or more time.
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.
Okay, you may be right. I looked at this a bit and didn't see a good solution either. I was afraid that we might be adding an unused
Self
import if all of theSelf
instances were quoted, but that doesn't appear to be the case: https://play.ruff.rs/014e3efe-829c-42b9-af40-f3527508bc57 (no import warnings withALL
rules selected). So I'm happy moving forward with the current version. Thanks!