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

Change subject: [flake8] solve some flake8 issues
......................................................................

[flake8] solve some flake8 issues

Change-Id: Icf7ae49daa4d8ff874de419abdf07535d9b6174e
---
M pywikibot/page/_user.py
M pywikibot/site/_apisite.py
M pywikibot/site/_siteinfo.py
M scripts/maintenance/unidata.py
M setup.py
M tests/utils.py
6 files changed, 24 insertions(+), 13 deletions(-)

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




diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 28ebd9c..2aee039 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -1,6 +1,6 @@
 """Object representing a Wiki user."""
 #
-# (C) Pywikibot team, 2009-2022
+# (C) Pywikibot team, 2009-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -261,10 +261,8 @@
         mailrequest = self.site.simple_request(**params)
         maildata = mailrequest.submit()

-        if 'emailuser' in maildata \
-           and maildata['emailuser']['result'] == 'Success':
-            return True
-        return False
+        return ('emailuser' in maildata
+                and maildata['emailuser']['result'] == 'Success')

     def block(self, *args, **kwargs):
         """
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 9aa95d4..37bbc8e 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1,6 +1,6 @@
 """Objects representing API interface to MediaWiki site."""
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1280,7 +1280,7 @@
     def image_repository(self) -> BaseSite | None:
         """Return Site object for image repository e.g. commons."""
         code, fam = self.shared_image_repository()
-        if bool(code or fam):
+        if code or fam:
             return pywikibot.Site(code, fam, self.username())

         return None
diff --git a/pywikibot/site/_siteinfo.py b/pywikibot/site/_siteinfo.py
index 5a1dd48..cf7251a 100644
--- a/pywikibot/site/_siteinfo.py
+++ b/pywikibot/site/_siteinfo.py
@@ -1,6 +1,6 @@
 """Objects representing site info data contents."""
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -82,7 +82,7 @@
             if prop in ('namespaces', 'magicwords'):
                 for index, value in enumerate(data):
                     # namespaces uses a dict, while magicwords uses a list
-                    key = index if type(data) is list else value
+                    key = index if isinstance(data, list) else value
                     for p in Siteinfo.BOOLEAN_PROPS[prop]:
                         data[key][p] = p in data[key]
             else:
diff --git a/scripts/maintenance/unidata.py b/scripts/maintenance/unidata.py
index f2284c4..cb20643 100755
--- a/scripts/maintenance/unidata.py
+++ b/scripts/maintenance/unidata.py
@@ -10,7 +10,7 @@
 .. versionadded:: 8.4
 """
 #
-# (C) Pywikibot team, 2018-2023
+# (C) Pywikibot team, 2018-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -38,7 +38,7 @@
     chars = []
     uppers = []
     wikilinks = ''
-    for i in range(0, maxunicode + 1):
+    for i in range(maxunicode + 1):
         c = chr(i)
         uc = c.upper()
         if uc != c:
diff --git a/setup.py b/setup.py
index 3a23a45..0275e71 100755
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,8 @@
 #
 # Distributed under the terms of the MIT license.
 #
+from __future__ import annotations
+
 import os
 import re
 import sys
@@ -57,6 +59,8 @@
         'flake8-bugbear>=23.3.12',
         'flake8-comprehensions>=3.13.0',
         'flake8-docstrings>=1.4.0',
+        'flake8-executable',
+        'flake8-future-annotations',
         'flake8-mock-x2',
         'flake8-print>=5.0.0',
         'flake8-quotes>=3.3.2',
diff --git a/tests/utils.py b/tests/utils.py
index 7269ea5..bfa2760 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -390,7 +390,7 @@
     def image_repository(self):
         """Return Site object for image repository e.g. commons."""
         code, fam = self.shared_image_repository()
-        if bool(code or fam):
+        if code or fam:
             return pywikibot.Site(code, fam, self.username(),
                                   interface=self.__class__)
         return None
@@ -411,7 +411,7 @@
                             'wikivoyage'):
             code, fam = None, None

-        if bool(code or fam):
+        if code or fam:
             return pywikibot.Site(code, fam, self.username(),
                                   interface=DryDataSite)
         return None

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/991882
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: Icf7ae49daa4d8ff874de419abdf07535d9b6174e
Gerrit-Change-Number: 991882
Gerrit-PatchSet: 13
Gerrit-Owner: Xqt <[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