-
Notifications
You must be signed in to change notification settings - Fork 624
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
use f-strings instead of format #693
Conversation
@@ -349,10 +349,7 @@ def test_trace_response_headers(self): | |||
) | |||
self.assertEqual( | |||
response.headers["traceresponse"], | |||
"00-{0}-{1}-01".format( |
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.
Cases like these where you don't have short variable, f-strings can be pretty ugly :( imo it's pretty unreadable compared to the format equivalent.
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 hear that... I don't feel strongly either ways. I found the formatting previously there confusing as well w/ the multiple 0's and 1's 😄
Could create a temporary variable or just disable pylint for this line.
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.
It's probably more readable when it's not complex code buried in a string - I prefer the format one.
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 found the formatting previously there confusing as well w/ the multiple 0's and 1's
I agree, maybe short variable names with f-strings would be better here, or could do "00-{}-{}-01".format(...)
or named format params. I'll leave it up to you, don't want to block this @codeboten
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'm happy to fix this in a following PR. I will refactor all the tests that are duplicated into a single test in the base class.
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.
will use the following method to simplify the code open-telemetry/opentelemetry-python#2159
21f8aff
to
995bb59
Compare
Description
Continuing work to support pylint 2.11.0, addressing string formatting in code.
Fixes #692