-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[flake8-pyi] Skip Annotated and Literal for string-or-bytes-too-long (PYI053)
#13020
base: main
Are you sure you want to change the base?
Conversation
|
/// ```python | ||
/// def f(x: Annotated[int, "A"]): ... | ||
/// ``` | ||
const TYPING_ANNOTATED_PEP593 = 1<<27; |
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.
oof... but I have been trying to think of a better name for 10 minutes and I've got nothing 😆
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 a reasonable name given other variants although I leave this up to you to decide, maybe you come up with a better name in the morning ;)
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.
Aside, it would be useful to provide a link to PEP 593 in the documentation above @dylwil3
I know this has been waiting on me for a little bit -- have to call it for the day now, but will try to land it tomorrow! |
No worries at all! |
@AlexWaygood if it was possible to meekly whisper a nudge in the form of a notification, I would, but github allows for only one volume. Let me know if there's anything else you'd like me to do on this one 😄 |
@dylwil3 - Just a heads up (in case it wasn't mentioned elsewhere) that Alex is on vacation this week so may be a few more days before he gets to it. (It's totally fine that you nudged and in fact your nudge was very gracious!) |
PYI053 now skips strings which appear inside
Literal[...]
orAnnotated[...]
.This is a modification of #13002, which skipped any type annotation for this rule. So, on the one hand, this PR allows the check to proceed in some cases that the prior PR skipped (e.g. return type annotations wrapped - unnecessarily, for a stub file - in quotes), and, on the other hand, this PR skips certain strings that the prior PR did not (e.g. type alias assignments to a
Literal
orAnnotated
type.)In order to implement this change, the PR adds a new semantic flag for PEP593 annotations (i.e.
typing.Annotated[...]
)Closes #12995 (hopefully!)