-
Notifications
You must be signed in to change notification settings - Fork 50
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
pyupgrade "UP" linting rules integration, code fixes to comply #836
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ def _canonical_string_encoder(string): | |
A string with the canonical-encoded 'string' embedded. | ||
""" | ||
|
||
string = '"%s"' % string.replace("\\", "\\\\").replace('"', '\\"') | ||
string = '"{}"'.format(string.replace("\\", "\\\\").replace('"', '\\"')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to be the important line in this patch -- everythings else is error messages or otherwise non-critical. This seems correct to me. I assume the reason for using format() here is the "quote-quoting" that would be tricky with f-strings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes the issue is with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am mistaken, backslashes are not allowed inside the f-string expression. Keeping it as is will be the most readable solution and is accepted by the linter. |
||
|
||
return string | ||
|
||
|
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 suppose this could be just
"keyid": keyid,
but I I think as a pure conversion commit this is fine tooThere 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, this line makes no sense like this, will change to
"keyid": keyid