-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve TypeVar name regex #7322
Conversation
Pull Request Test Coverage Report for Build 2888845479
💛 - Coveralls |
@DanielNoord Do you know what I need to do for the checks to pass? Should I change the fragment suffix to |
@Pierre-Sassoulas We still can't seem to merge without updating branches 😢 |
a9ab795
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
I'm going to look into it, I'm not on mobile anymore. I hope you'll get admin-ship soon, be it the easy way or the hard way 😄 |
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.
Seems like requiring a new review if the code change also auto-checked the "up to date code" option.
🤖 Effect of this PR on checked open source code: 🤖 Effect on astroid:
Effect on pandas:
Effect on pytest:
Effect on sentry:
This comment was generated for commit a9ab795 |
@cdce8p Where does the recommendation to avoid a |
@mattclay I think this follows from what we have "seen in the wild". Note that you can allow them again by setting the |
The new regex also disallows things like |
@DanielNoord I don't know how common the I realize the pattern can be customized, but it seems like an unnecessarily arbitrary stylistic restriction for a default. |
This is problematic indeed.
@cdce8p Do you have on opinion on this? If not I think we might want to revert this change. |
I mainly looked at a number of typing PEPs as well as the TypeVar names used within typeshed as reference. Those do strongly prefer a
It's not as common as you may think. I would even argue that it's an antipattern which should be avoided except for very specific cases. It's much better to use different / more verbose names to avoid confusion and improve readability. Some common once include |
Description
Small improvements for the
TypeVar
name regex.[^\W\da-z_]
to[A-Z]
T
orType
prefix. E.g.TAnyStr
should be marked asinvalid-name
.