Xqt submitted this change.

View Change


Approvals: Xqt: Verified; Looks good to me, approved
[flake8] fix bugbear 24.1.17 issues

All of the B038 issues are not related to us and are false positives.
We can ignore them. I leave a comment for the reason.

Bug: T355372
Change-Id: I47462971df848293380727f4645d7b2fe61d7725
---
M pywikibot/data/api/__init__.py
M pywikibot/proofreadpage.py
M scripts/dataextend.py
3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/pywikibot/data/api/__init__.py b/pywikibot/data/api/__init__.py
index 530f15b..9f289ab 100644
--- a/pywikibot/data/api/__init__.py
+++ b/pywikibot/data/api/__init__.py
@@ -1,6 +1,6 @@
"""Interface to Mediawiki's api.php."""
#
-# (C) Pywikibot team, 2014-2023
+# (C) Pywikibot team, 2014-2024
#
# Distributed under the terms of the MIT license.
#
@@ -57,7 +57,10 @@
if isinstance(family, SubdomainFamily):
for cookie in http.cookie_jar:
if family.domain == cookie.domain:
- http.cookie_jar.clear(cookie.domain, cookie.path, cookie.name)
+ # ignore B038: iterating over cookies already uses a list,
+ # created in cookiejar.deepvalues()
+ http.cookie_jar.clear( # noqa: B038
+ cookie.domain, cookie.path, cookie.name)


# Bug: T113120, T228841
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 7e7c24e..8f217e9 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -22,7 +22,7 @@

"""
#
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
#
# Distributed under the terms of the MIT license.
#
@@ -543,7 +543,8 @@
if self._num is not None:
for page in what_links_here:
if page.title(with_ns=False) == self._base:
- what_links_here.remove(page)
+ # ignore B038, we break the loop after removal
+ what_links_here.remove(page) # noqa: B038
self._index = (page, what_links_here)
break

diff --git a/scripts/dataextend.py b/scripts/dataextend.py
index e63cf36..0c97fe9 100755
--- a/scripts/dataextend.py
+++ b/scripts/dataextend.py
@@ -54,7 +54,7 @@
.. versionadded:: 7.2
"""
#
-# (C) Pywikibot team, 2020-2023
+# (C) Pywikibot team, 2020-2024
#
# Distributed under the terms of the MIT license.
#
@@ -967,7 +967,9 @@
claim[0]])].addSources(sourcedata)
else:
if claim[0] not in propsdone:
- propstodo.append(claim[0])
+ # DequeGenerator is intended to add items
+ # during generation, therefore ignore B038
+ propstodo.append(claim[0]) # noqa: B038

createdclaim = pywikibot.Claim(self.site, claim[0])

@@ -1093,7 +1095,8 @@
0]])].addSources(sourcedata)
except AttributeError:
if prop not in propsdone:
- propstodo.append(prop)
+ # ignore B038 due to DequeGenerator
+ propstodo.append(prop) # noqa: B038
pywikibot.info('Sourcing failed')

for language, description in analyzer.getdescriptions():

To view, visit change 991742. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I47462971df848293380727f4645d7b2fe61d7725
Gerrit-Change-Number: 991742
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr@wikimedia.org>
Gerrit-Reviewer: Huji <huji.huji@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged