Fix and re-enable unnecessary-comprehension and use-dict-literal pylint tags

This commit is contained in:
Laerte Pereira 2024-02-28 16:14:08 -03:00
parent 532cc8a517
commit 63acd07209
4 changed files with 3 additions and 5 deletions

View File

@ -68,7 +68,6 @@ disable=abstract-method,
too-many-public-methods,
too-many-return-statements,
unbalanced-tuple-unpacking,
unnecessary-comprehension,
unnecessary-dunder-call,
unnecessary-pass,
unreachable,
@ -77,7 +76,6 @@ disable=abstract-method,
unused-private-member,
unused-variable,
unused-wildcard-import,
use-dict-literal,
used-before-assignment,
useless-return,
wildcard-import,

View File

@ -135,7 +135,7 @@ class HttpCompressionMiddleware:
respcls = responsetypes.from_args(
headers=response.headers, url=response.url, body=decoded_body
)
kwargs = dict(cls=respcls, body=decoded_body)
kwargs = {"cls": respcls, "body": decoded_body}
if issubclass(respcls, TextResponse):
# force recalculating the encoding until we make sure the
# responsetypes guessing is reliable

View File

@ -85,7 +85,7 @@ class CrawlSpider(Spider):
url=link.url,
callback=self._callback,
errback=self._errback,
meta=dict(rule=rule_index, link_text=link.text),
meta={"rule": rule_index, "link_text": link.text},
)
def _requests_to_follow(self, response):

View File

@ -162,7 +162,7 @@ def re_rsearch(
pattern = re.compile(pattern)
for chunk, offset in _chunk_iter():
matches = [match for match in pattern.finditer(chunk)]
matches = list(pattern.finditer(chunk))
if matches:
start, end = matches[-1].span()
return offset + start, offset + end