Skip to content

Commit

Permalink
[flake8] fix bugbear 24.1.17 issues
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xqt committed Jan 20, 2024
1 parent 1eb0aeb commit dd453a2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 5 additions & 2 deletions pywikibot/data/api/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -57,7 +57,10 @@ def _invalidate_superior_cookies(family) -> None:
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
Expand Down
5 changes: 3 additions & 2 deletions pywikibot/proofreadpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""
#
# (C) Pywikibot team, 2015-2023
# (C) Pywikibot team, 2015-2024
#
# Distributed under the terms of the MIT license.
#
Expand Down Expand Up @@ -543,7 +543,8 @@ def index(self) -> IndexPage | None:
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

Expand Down
9 changes: 6 additions & 3 deletions scripts/dataextend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -967,7 +967,9 @@ def treat(self, item) -> None:
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])

Expand Down Expand Up @@ -1093,7 +1095,8 @@ def treat(self, item) -> None:
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():
Expand Down

0 comments on commit dd453a2

Please sign in to comment.