jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/769967 )

Change subject: [IMPR] solve some deepsource issues
......................................................................

[IMPR] solve some deepsource issues

Change-Id: Iaf8b83b81ea525fca9bd2f9ea58b5650b3686f07
---
M pwb.py
M pywikibot/__init__.py
M pywikibot/backports.py
M pywikibot/bot.py
M pywikibot/data/api.py
M pywikibot/date.py
M pywikibot/family.py
M pywikibot/page/__init__.py
M pywikibot/pagegenerators.py
M pywikibot/proofreadpage.py
M pywikibot/site/__init__.py
M pywikibot/site/_apisite.py
M pywikibot/site/_datasite.py
M pywikibot/site/_extensions.py
M pywikibot/site/_generators.py
M pywikibot/specialbots/__init__.py
M pywikibot/tools/__init__.py
M pywikibot/tools/djvu.py
M pywikibot/version.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/category.py
M scripts/checkimages.py
M scripts/commonscat.py
M scripts/harvest_template.py
M scripts/interwiki.py
M scripts/interwikidata.py
M scripts/listpages.py
M scripts/pagefromfile.py
M scripts/patrol.py
M scripts/redirect.py
M scripts/speedy_delete.py
M scripts/unusedfiles.py
M scripts/welcome.py
M tests/api_tests.py
M tests/deletionbot_tests.py
M tests/proofreadpage_tests.py
M tests/protectbot_tests.py
M tests/site_tests.py
M tests/tools_tests.py
41 files changed, 60 insertions(+), 79 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pwb.py b/pwb.py
index 94b567e..15715fe 100755
--- a/pwb.py
+++ b/pwb.py
@@ -346,8 +346,8 @@
         msg = '\nThe most similar scripts are:'
         alternatives = ShowingListOption(similar_scripts, pre=msg, post='')
         try:
-            prefix, script = input_choice('Which script to be run:',
-                                          alternatives, default='1')
+            _, script = input_choice('Which script to be run:',
+                                     alternatives, default='1')
         except QuitKeyboardInterrupt:
             return None
         print()  # pragma: no cover
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 29d266e..591b58f 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -32,7 +32,7 @@
     __version__,
 )
 from pywikibot._wbtypes import WbRepresentation as _WbRepresentation
-from pywikibot.backports import (
+from pywikibot.backports import (  # skipcq: PY-W2000
     Callable,
     Dict,
     List,
@@ -82,9 +82,8 @@
     'html2unicode', 'input', 'input_choice', 'input_yn', 'ItemPage', 'Link',
     'log', 'MediaInfo', 'output', 'Page', 'PropertyPage', 'showDiff',
     'show_help', 'Site', 'SiteLink', 'stdout', 'Timestamp', 'translate', 'ui',
-    'unicode2html', 'UploadWarning', 'url2unicode', 'User', 'warning',
-    'WbGeoShape', 'WbMonolingualText', 'WbQuantity', 'WbTabularData', 'WbTime',
-    'WbUnknown', 'WikidataBot',
+    'url2unicode', 'User', 'warning', 'WbGeoShape', 'WbMonolingualText',
+    'WbQuantity', 'WbTabularData', 'WbTime', 'WbUnknown', 'WikidataBot',
 )

 # argvu is set by pywikibot.bot when it's imported
diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 8897401..d5a0ba2 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -106,7 +106,7 @@
     removeprefix = str.removeprefix  # type: ignore[attr-defined]
     removesuffix = str.removesuffix  # type: ignore[attr-defined]
 else:
-    def removeprefix(string: str, prefix: str) -> str:
+    def removeprefix(string: str, prefix: str) -> str:  # skipcq: TYP-053
         """Remove prefix from a string or return a copy otherwise.

         .. versionadded:: 5.4
@@ -115,7 +115,7 @@
             return string[len(prefix):]
         return string

-    def removesuffix(string: str, suffix: str) -> str:
+    def removesuffix(string: str, suffix: str) -> str:  # skipcq: TYP-053
         """Remove prefix from a string or return a copy otherwise.

         .. versionadded:: 5.4
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index a4cdc44..ec2d322 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -695,7 +695,7 @@
         self._default = default
         self._quit = automatic_quit

-        current_match_type = Optional[Tuple[
+        current_match_type = Optional[Tuple[  # skipcq: PYL-W0612
             PageLinkType,
             str,
             Mapping[str, str],
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 90e8198..f03af4d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1256,7 +1256,7 @@
             raise TypeError(
                 "Query format '{}' cannot be parsed.".format(self['format']))

-        self.__defaulted = True
+        self.__defaulted = True  # skipcq: PTC-W0037

     def _encoded_items(self) -> Dict[str, Union[str, bytes]]:
         """
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 48d646a..a18f160 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -482,7 +482,7 @@
         numeral number.

     """
-    compPattern, strPattern, decoders = escapePattern2(pattern)
+    _compPattern, strPattern, decoders = escapePattern2(pattern)
     # Encode an integer value into a textual form.
     # This will be called from outside as well as recursivelly to verify
     # parsed value
@@ -510,7 +510,7 @@
 @dh.register(str)  # type: ignore
 def _(value: str, pattern: str, encf: encf_type, decf: decf_type,
       filter: Optional[Callable[[int], bool]] = None) -> int:
-    compPattern, strPattern, decoders = escapePattern2(pattern)
+    compPattern, _strPattern, decoders = escapePattern2(pattern)
     m = compPattern.match(value)
     if m:
         # decode each found value using provided decoder
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 171e740..8e1979d 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -19,7 +19,7 @@

 import pywikibot
 from pywikibot import config
-from pywikibot.backports import Dict, List, Set, Tuple
+from pywikibot.backports import Dict, List, Set, Tuple  # skipcq: PY-W2000
 from pywikibot.exceptions import FamilyMaintenanceWarning, UnknownFamilyError
 from pywikibot.tools import classproperty, deprecated

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 2fe45e3..4606772 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -97,8 +97,6 @@
     'SiteLink',
     'SiteLinkCollection',
     'html2unicode',
-    'UnicodeToAsciiHtml',
-    'unicode2html',
     'url2unicode',
 )

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 128a4d2..2022f22 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -899,8 +899,8 @@
             pnames = self.site.get_property_names()
             # also use the default by <enter> key
             if value == '?' or value not in pnames:
-                prefix, value = pywikibot.input_choice(
-                    question, ShowingListOption(pnames))
+                _, value = pywikibot.input_choice(question,
+                                                  ShowingListOption(pnames))
         return self.site.pages_with_property(value)

     def _handle_usercontribs(self, value: str) -> HANDLER_RETURN_TYPE:
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index b37b9a1..9ce5bf9 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -22,7 +22,7 @@

 """
 #
-# (C) Pywikibot team, 2015-2021
+# (C) Pywikibot team, 2015-2022
 #
 # Distributed under the terms of the MIT license.
 #
@@ -680,7 +680,7 @@
             soup = _bs4_soup(txt)  # type: ignore

             res = []
-            for ocr_page in soup.find_all(class_='ocr_page'):
+            for _ocr_page in soup.find_all(class_='ocr_page'):
                 for area in soup.find_all(class_='ocr_carea'):
                     for par in area.find_all(class_='ocr_par'):
                         for line in par.find_all(class_='ocr_line'):
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 04f3c49..33243e9 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -15,5 +15,4 @@


 __all__ = ('APISite', 'BaseSite', 'ClosedSite', 'DataSite', 'RemovedSite',
-           'Namespace', 'NamespacesDict', 'PageInUse', 'Siteinfo',
-           'TokenWallet')
+           'Namespace', 'NamespacesDict', 'Siteinfo', 'TokenWallet')
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 07fd907..8eba59a 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -14,7 +14,6 @@
 from typing import Any, Optional, Union

 import pywikibot
-import pywikibot.family
 from pywikibot.backports import Dict, List
 from pywikibot.comms.http import get_authentication
 from pywikibot.data import api
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index f5c8a2a..ebce64f 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -1,6 +1,6 @@
 """Objects representing API interface to Wikibase site."""
 #
-# (C) Pywikibot team, 2012-2021
+# (C) Pywikibot team, 2012-2022
 #
 # Distributed under the terms of the MIT license.
 #
@@ -12,7 +12,6 @@
 from warnings import warn

 import pywikibot
-import pywikibot.family
 from pywikibot.data import api
 from pywikibot.exceptions import (
     APIError,
diff --git a/pywikibot/site/_extensions.py b/pywikibot/site/_extensions.py
index ed7b597..38f53fa 100644
--- a/pywikibot/site/_extensions.py
+++ b/pywikibot/site/_extensions.py
@@ -5,7 +5,6 @@
 # Distributed under the terms of the MIT license.
 #
 import pywikibot
-import pywikibot.family
 from pywikibot.data import api
 from pywikibot.echo import Notification
 from pywikibot.exceptions import (
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index f8ab2ad..bf0b494 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -13,8 +13,7 @@
 from warnings import warn

 import pywikibot
-import pywikibot.family
-from pywikibot.backports import Dict, Generator, Iterable, List
+from pywikibot.backports import Dict, Generator, Iterable, List  # skipcq
 from pywikibot.data import api
 from pywikibot.exceptions import (
     APIError,
@@ -1828,8 +1827,8 @@
                 errdata = {
                     'site': self,
                     'user': self.user(),
+                    idtype: idvalue,
                 }
-                errdata[idtype] = idvalue
                 if err.code in self._patrol_errors:
                     raise Error(self._patrol_errors[err.code]
                                 .format_map(errdata))
diff --git a/pywikibot/specialbots/__init__.py 
b/pywikibot/specialbots/__init__.py
index 9388248..125522a 100644
--- a/pywikibot/specialbots/__init__.py
+++ b/pywikibot/specialbots/__init__.py
@@ -10,7 +10,6 @@

 __all__ = (
     'BaseUnlinkBot',
-    'EditReplacement',
     'InteractiveUnlink',
     'UploadRobot',
 )
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index be13914..d14fc09 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -29,7 +29,7 @@
 import pkg_resources

 from pywikibot.logging import debug
-from pywikibot.tools._deprecate import (  # noqa: F401
+from pywikibot.tools._deprecate import (  # noqa: F401 skipcq: PY-W2000
     ModuleDeprecationWrapper,
     add_decorated_full_name,
     add_full_name,
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index c657df0..85966da 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -251,8 +251,8 @@
         size, dpi = self.get_most_common_info()

         # Generate white_page.
-        res, data = _call_cmd(['convert', '-size', size, 'xc:white',
-                               white_ppm], lib='ImageMagik')
+        res, _ = _call_cmd(['convert', '-size', size, 'xc:white', white_ppm],
+                           lib='ImageMagik')
         if not res:
             return False

@@ -299,7 +299,7 @@
         # Delete page n.
         # Get ref page info for later checks.
         info_ref_page = self.page_info(ref_page)
-        res, data = _call_cmd(['djvm', '-d', self.file, n])
+        res, _ = _call_cmd(['djvm', '-d', self.file, n])
         if not res:
             return False

diff --git a/pywikibot/version.py b/pywikibot/version.py
index 5032ebe..1145497 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -168,7 +168,7 @@
         cur.execute("""select
 local_relpath, repos_path, revision, changed_date, checksum from nodes
 order by revision desc, changed_date desc""")
-        name, tag, rev, date, checksum = cur.fetchone()
+        _name, tag, rev, date, _checksum = cur.fetchone()
         cur.execute('select root from repository')
         tag, = cur.fetchone()

@@ -265,7 +265,7 @@
                            '--date=iso'],
                           cwd=_program_dir,
                           stdout=subprocess.PIPE)
-    info, stderr = dp.communicate()
+    info, _ = dp.communicate()
     info = info.decode(config.console_encoding).split('|')
     date = info[0][:-6]
     date = time.strptime(date.strip('"'), '%Y-%m-%d %H:%M:%S')
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 04e365b..ddd9802 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -779,7 +779,7 @@
             pywikibot.output('Archiving {} thread(s).'
                              .format(self.archived_threads))
             # Save the archives first (so that bugs don't cause a loss of data)
-            for title, archive in sorted(self.archives.items()):
+            for _title, archive in sorted(self.archives.items()):
                 count = archive.archived_threads
                 if count == 0:
                     continue
diff --git a/scripts/basic.py b/scripts/basic.py
index b11b772..be0bd33 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -149,7 +149,7 @@

     # Parse your own command line arguments
     for arg in local_args:
-        arg, sep, value = arg.partition(':')
+        arg, _, value = arg.partition(':')
         option = arg[1:]
         if option in ('summary', 'text'):
             if not value:
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index b1ce7e1..9420fc2 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -461,9 +461,6 @@

     :param args: command line arguments
     """
-    # Loading the comments
-    global category_to_check, project_inserted
-
     options = {}
     generator = None

@@ -482,7 +479,7 @@

     # Process local args
     for arg in local_args:
-        arg, sep, value = arg.partition(':')
+        arg, _, value = arg.partition(':')
         option = arg[1:]
         if arg in ('-always', '-move', '-show'):
             options[option] = True
diff --git a/scripts/category.py b/scripts/category.py
index e5c13ef..03cd40e 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -136,7 +136,7 @@

 import pywikibot
 from pywikibot import config, i18n, pagegenerators, textlib
-from pywikibot.backports import Sequence, Set
+from pywikibot.backports import Sequence, Set  # skipcq: PY-W2000
 from pywikibot.bot import (
     BaseBot,
     Bot,
@@ -272,7 +272,7 @@

         tmpl = []  # type: Sequence
         with suppress(KeyError):
-            tmpl, loc = moved_links[page.site.code]
+            tmpl, _loc = moved_links[page.site.code]

         if not isinstance(tmpl, list):
             tmpl = [tmpl]
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 62d4363..4ec829b 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -825,7 +825,7 @@
             return list_given[inx_found][1]

         # find the oldest image
-        sec, image = max(list_given, key=lambda element: element[0])
+        _, image = max(list_given, key=lambda element: element[0])
         return image

     def check_image_on_commons(self) -> bool:
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 45bd4e2..1cef514 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -279,7 +279,7 @@
         """
         page = self.current_page
         # Get the right templates for this page
-        primaryCommonscat, commonscatAlternatives = i18n.translate(
+        primaryCommonscat, _alternatives = i18n.translate(
             page.site.code, commonscatTemplates,
             fallback=i18n.DEFAULT_FALLBACK)

@@ -288,7 +288,7 @@
             pywikibot.output('Commonscat template is already on '
                              + page.title())
             (currentCommonscatTemplate,
-             currentCommonscatTarget, LinkText, Note) = commonscatLink
+             currentCommonscatTarget, LinkText, _note) = commonscatLink
             checkedCommonscatTarget = self.checkCommonscatLink(
                 currentCommonscatTarget)

@@ -554,7 +554,7 @@

     if checkcurrent:
         site = pywikibot.Site()
-        primaryCommonscat, commonscatAlternatives = i18n.translate(
+        primaryCommonscat, _alternatives = i18n.translate(
             site.code, commonscatTemplates, fallback=i18n.DEFAULT_FALLBACK)
         template_page = pywikibot.Page(site, 'Template:' + primaryCommonscat)
         generator = template_page.getReferences(namespaces=14,
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 3c72f17..e647160 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -94,7 +94,7 @@
    can be set within a settings file which is scripts.ini by default.
 """
 #
-# (C) Pywikibot team, 2013-2021
+# (C) Pywikibot team, 2013-2022
 #
 # Distributed under the terms of MIT License.
 #
@@ -394,7 +394,7 @@
                 if needs_second:
                     break  # will stop below

-                arg, sep, value = arg[1:].partition(':')
+                arg, _, value = arg[1:].partition(':')
                 if len(current_args) == 0:
                     assert not fields
                     options[arg] = value or True
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 6dff347..540280a 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1511,7 +1511,7 @@
                         pywikibot.output('BUG>>> {} no longer exists?'
                                          .format(new[site]))
                         continue
-                    mods, mcomment, adding, removing, modifying \
+                    _mods, _comment, adding, removing, modifying \
                         = compareLanguages(old, new, lclSite,
                                            self.conf.summary)
                     if (removing and not self.conf.autonomous
@@ -1628,12 +1628,8 @@
             old[page2.site] = page2

         # Check what needs to get done
-        mods, mcomment, adding, removing, modifying = compareLanguages(
-            old,
-            new,
-            page.site,
-            self.conf.summary
-        )
+        mods, _comment, _adding, removing, modifying = compareLanguages(
+            old, new, page.site, self.conf.summary)

         # When running in autonomous mode without -force switch, make sure we
         # don't remove any items, but allow addition of the new ones
@@ -1904,7 +1900,7 @@
         pywikibot.output(
             'NOTE: Number of pages queued is {}, trying to add {} more.'
             .format(len(self.subjects), number))
-        for i in range(number):
+        for _ in range(number):
             for page in self.pageGenerator:
                 if page in self.conf.skip:
                     pywikibot.output('Skipping: {} is in the skip list'
@@ -2052,10 +2048,11 @@
         # Get the content of the assembled list in one blow
         gen = site.preloadpages(pageGroup, templates=True, langlinks=True,
                                 pageprops=True)
-        for page in gen:
+        for _ in gen:
             # we don't want to do anything with them now. The
             # page contents will be read via the Subject class.
             pass
+
         # Tell all of the subjects that the promised work is done
         for subject in subjectGroup:
             subject.batchLoaded(self)
diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index e56a1bf..fcd053a 100755
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -29,7 +29,7 @@
    can be set within a settings file which is scripts.ini by default.
 """

-# (C) Pywikibot team, 2015-2021
+# (C) Pywikibot team, 2015-2022
 #
 # Distributed under the terms of the MIT license.
 #
@@ -243,7 +243,7 @@

     options = {}
     for arg in local_args:
-        option, sep, value = arg.partition(':')
+        option, _, value = arg.partition(':')
         option = option[1:] if option.startswith('-') else None
         if option == 'summary':
             options[option] = value
diff --git a/scripts/listpages.py b/scripts/listpages.py
index df8c1f6..0c5e9b2 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -87,7 +87,7 @@
 &params;
 """
 #
-# (C) Pywikibot team, 2008-2021
+# (C) Pywikibot team, 2008-2022
 #
 # Distributed under the terms of the MIT license.
 #
@@ -189,7 +189,7 @@
     gen_factory = GeneratorFactory()

     for arg in local_args:
-        option, sep, value = arg.partition(':')
+        option, _, value = arg.partition(':')
         if option == '-notitle':
             notitle = True
         elif option == '-format':
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 0a439d3..fd29a6b 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -60,7 +60,7 @@
 can be added between them by specifying '\n' as a value.
 """
 #
-# (C) Pywikibot team, 2004-2021
+# (C) Pywikibot team, 2004-2022
 #
 # Distributed under the terms of the MIT license.
 #
@@ -279,7 +279,7 @@
     r_options = {}

     for arg in pywikibot.handle_args(args):
-        arg, sep, value = arg.partition(':')
+        arg, _, value = arg.partition(':')
         option = arg.partition('-')[2]
         # reader options
         if option in ('begin', 'end', 'titlestart', 'titleend', 'title'):
diff --git a/scripts/patrol.py b/scripts/patrol.py
index ab04b4e..f2d33ec 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -220,7 +220,7 @@
                     # this allows a prefix that doesn't match an existing page
                     # to be a blue link, and can be clicked to see what pages
                     # will be included in the whitelist
-                    name, sep, prefix = obj.title.partition('/')
+                    name, _, prefix = obj.title.partition('/')
                     if name.lower() in self._prefixindex_aliases:
                         if not prefix:
                             verbose_output('Whitelist everything')
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 8738b0a..9be2554 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -452,7 +452,7 @@
         if isinstance(item, str):
             item = pywikibot.Page(default_site, item)
         elif isinstance(item, tuple):
-            redir_name, code, target, final = item
+            redir_name, code, *_ = item
             item = pywikibot.Page(default_site, redir_name)
             item._redirect_type = code
         page = super().init_page(item)
@@ -698,7 +698,7 @@

     local_args = pywikibot.handle_args(args)
     for argument in local_args:
-        arg, sep, value = argument.partition(':')
+        arg, _, value = argument.partition(':')
         option = arg.partition('-')[2]
         # bot options
         if arg == 'do':
diff --git a/scripts/speedy_delete.py b/scripts/speedy_delete.py
index ede64b9..d512230 100755
--- a/scripts/speedy_delete.py
+++ b/scripts/speedy_delete.py
@@ -353,7 +353,7 @@
             templates = page.templatesWithParams()
             reasons = i18n.translate(self.site, self.deletion_messages)

-            for template, params in templates:
+            for template, _ in templates:
                 template_name = template.title().lower()
                 if template_name in reasons:
                     if not isinstance(reasons[template_name], str):
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index c61bee5..4512329 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -168,7 +168,7 @@
     local_args = pywikibot.handle_args(args)

     for arg in local_args:
-        arg, sep, value = arg.partition(':')
+        arg, _, value = arg.partition(':')
         if arg == '-limit':
             total = value
         elif arg == '-filetemplate':
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 8390524..cf290a8 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -173,7 +173,7 @@

 import pywikibot
 from pywikibot import config, i18n
-from pywikibot.backports import Dict, Generator, List
+from pywikibot.backports import Dict, Generator, List  # skipcq: PY-W2000
 from pywikibot.bot import SingleSiteBot
 from pywikibot.exceptions import EditConflictError, Error, HiddenKeyError
 from pywikibot.tools.formatter import color_format
diff --git a/tests/api_tests.py b/tests/api_tests.py
index af3b672..25f1f7f 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -13,8 +13,6 @@
 from unittest.mock import patch

 import pywikibot.family
-import pywikibot.login
-import pywikibot.page
 import pywikibot.site
 from pywikibot.data import api
 from pywikibot.exceptions import APIError, NoUsernameError
diff --git a/tests/deletionbot_tests.py b/tests/deletionbot_tests.py
index a82e126..71dbdbe 100644
--- a/tests/deletionbot_tests.py
+++ b/tests/deletionbot_tests.py
@@ -9,7 +9,6 @@
 from contextlib import suppress

 import pywikibot
-import pywikibot.page
 from scripts import delete
 from tests.aspects import ScriptMainTestCase
 from tests.utils import empty_sites
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py
index 33f29f3..627a7136 100644
--- a/tests/proofreadpage_tests.py
+++ b/tests/proofreadpage_tests.py
@@ -442,7 +442,7 @@
         except Exception as exc:
             self.assertIsInstance(exc, ValueError)
         else:
-            ref_error, ref_text = self.data['wmfOCR']
+            _error, ref_text = self.data['wmfOCR']
             s = difflib.SequenceMatcher(None, text, ref_text)
             self.assertGreater(s.ratio(), 0.9)

@@ -680,7 +680,7 @@
         data = self.sites[key]
         index_page = IndexPage(self.site, self.sites[key]['index'])

-        num, title_num, label = data['get_label']
+        num, _title_num, label = data['get_label']
         self.assertIs(index_page._cached, False)
         fetched_label = index_page.get_label_from_page_number(num)

@@ -763,7 +763,7 @@
     def test_page_gen(self, key):
         """Test Index page generator."""
         data = self.sites[key]
-        num, title_num, label = data['get_label']
+        num, title_num, _label = data['get_label']

         index_page = IndexPage(self.site, self.sites[key]['index'])
         page_title = self.sites[key]['page'].format(title_num)
diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index 42d4c97..313a037 100644
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -9,7 +9,6 @@
 from contextlib import suppress

 import pywikibot
-import pywikibot.page
 from scripts import protect
 from tests.aspects import ScriptMainTestCase

diff --git a/tests/site_tests.py b/tests/site_tests.py
index da62cf2..3bdf8e6 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -2241,7 +2241,7 @@

         fp1 = pywikibot.FilePage(site, 'File:T276726.png')
         site.loadimageinfo(fp1, history=True)
-        for idx, v in fp1._file_revisions.items():
+        for v in fp1._file_revisions.values():
             if v['timestamp'] == ts1:
                 self.assertTrue(hasattr(v, 'userhidden'))

diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index bc7751b..db010d3 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -5,7 +5,7 @@
 #
 # Distributed under the terms of the MIT license.
 import decimal
-import os.path
+import os
 import subprocess
 import tempfile
 import unittest

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/769967
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iaf8b83b81ea525fca9bd2f9ea58b5650b3686f07
Gerrit-Change-Number: 769967
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to