-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Track t-strings and f-strings for token-based rules and suppression comments #20357
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
|
ntBre
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.
Nice, thank you! This looks good to me, I just had a few questions for my understanding and a couple of very minor nits.
Our token-based rules and
noqaextraction used anIndexerthat kept track of f-string ranges but not t-strings. We've updated theIndexerand downstream uses thereof to handle both f-strings and t-strings.Most of the diff is renaming and adding tests.
Note that much of the "new" logic gets to be naive because the lexer has already ensured that f and t-string "starts" are paired with their respective "ends", even amidst nesting and so on.
Finally: one could imagine wanting to know if a given interpolated string range corresponds to an f-string or a t-string, but I didn't find a place where we actually needed this.
Closes #20310