-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
5245 f-strings #5246
5245 f-strings #5246
Conversation
scrapy/extensions/httpcache.py
Outdated
logger.debug("Using DBM cache storage in %(cachepath)s" % {'cachepath': dbpath}, extra={'spider': spider}) | ||
logger.debug(f"Using DBM cache storage in {dbpath}", extra={'spider': spider}) |
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.
Old message from pylint
related to this code line:
scrapy/extensions/httpcache.py:229:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
New message from pylint
related to this code line:
scrapy/extensions/httpcache.py:229:8: W1203: Use lazy % or .format() or % formatting in logging functions (logging-fstring-interpolation)
@@ -70,7 +70,7 @@ def process_request(self, request: Request, spider: Spider) -> Optional[Response | |||
self.stats.inc_value('httpcache/miss', spider=spider) | |||
if self.ignore_missing: | |||
self.stats.inc_value('httpcache/ignore', spider=spider) | |||
raise IgnoreRequest("Ignored request not in cache: %s" % request) | |||
raise IgnoreRequest(f"Ignored request not in cache: {str(request)}") |
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.
raise IgnoreRequest(f"Ignored request not in cache: {str(request)}") | |
raise IgnoreRequest(f"Ignored request not in cache: {request}") |
Use str
inside a f-string is redudant, same for others places.
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.
Ok, thanks @Laerte
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.
@GeorgeA92 No problem, great work btw.
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 think this wasn't implemented?
Codecov Report
@@ Coverage Diff @@
## master #5246 +/- ##
==========================================
+ Coverage 88.51% 88.53% +0.02%
==========================================
Files 163 163
Lines 10592 10611 +19
Branches 1524 1559 +35
==========================================
+ Hits 9375 9394 +19
+ Misses 943 942 -1
- Partials 274 275 +1
|
Looks like there is now a TypeError in the spider ran in |
@wRAR remaining errors fixed. checks/tests passed |
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 believe the only thing missing now is #5246 (comment)
"Stored %s", logmsg, | ||
extra={'spider': spider} |
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.
(Nitpick) I would suggest either putting everything in the same line (which should be ok given our current line length), or each argument in its own line.
@Gallaecio |
Yeap, @elacuesta was aware and left the work to you. Bad @elacuesta 🙂 |
@GeorgeA92 Also, please, do not forget to address #5246 (comment) , I think you forgot about that at some point. |
Actually, I think I misinterpreted his comment. |
Related to #5245
Replaced string format by usage if f-strings in places mentioned in recent
pylint
checks.(edit) fixes #5245