jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052416?usp=email )

Change subject: [IMPR] remove antipatterns
......................................................................

[IMPR] remove antipatterns

- combine multiple if statements
- hide unused variables

Change-Id: I5f197d3e2c7e02ba86418df783e77a02e89bf655
---
M pywikibot/data/superset.py
M pywikibot/tools/djvu.py
M scripts/maintenance/unidata.py
M scripts/touch.py
4 files changed, 10 insertions(+), 11 deletions(-)

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




diff --git a/pywikibot/data/superset.py b/pywikibot/data/superset.py
index 20ee653..aabcfa2 100644
--- a/pywikibot/data/superset.py
+++ b/pywikibot/data/superset.py
@@ -50,10 +50,9 @@
             raise TypeError(msg)

         # Validate database_id
-        if database_id:
-            if not isinstance(database_id, int):
-                msg = f'database_id should be integer, but got "{database_id}"'
-                raise TypeError(msg)
+        if database_id and not isinstance(database_id, int):
+            msg = f'database_id should be integer, but got "{database_id}"'
+            raise TypeError(msg)

         self.site = site
         self.schema_name = schema_name
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index d2413ae..3aba267 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -1,6 +1,6 @@
 """Wrapper around djvulibre to access djvu files properties and content."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -255,7 +255,7 @@
             return False

         # Convert white_page to djvu.
-        res, data = _call_cmd(['c44', white_ppm, '-dpi', str(dpi)])
+        res, _ = _call_cmd(['c44', white_ppm, '-dpi', str(dpi)])
         os.unlink(white_ppm)  # rm white_page.ppm before returning.
         if not res:
             return False
@@ -263,12 +263,12 @@
         # 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, str(n)])
+        res, _ = _call_cmd(['djvm', '-d', self.file, str(n)])
         if not res:
             return False

         # Insert new page
-        res, data = _call_cmd(['djvm', '-i', self.file, white_djvu, str(n)])
+        res, _ = _call_cmd(['djvm', '-i', self.file, white_djvu, str(n)])
         os.unlink(white_djvu)  # rm white_page.djvu before returning.
         if not res:
             return False
diff --git a/scripts/maintenance/unidata.py b/scripts/maintenance/unidata.py
index 9f02bd4..1c77aec 100755
--- a/scripts/maintenance/unidata.py
+++ b/scripts/maintenance/unidata.py
@@ -97,7 +97,7 @@
     """Prepare several threads."""
     # TODO: use ThreadList instead
     threads = []
-    for i in range(NUMBER_OF_THREADS):
+    for _ in range(NUMBER_OF_THREADS):
         t = Thread(target=threads_target, args=(q,))
         t.start()
         threads.append(t)
@@ -106,7 +106,7 @@

 def stop_threads(q, threads):
     """Stop threads."""
-    for i in range(NUMBER_OF_THREADS):
+    for _ in range(NUMBER_OF_THREADS):
         q.put(None)
     for t in threads:
         t.join()
diff --git a/scripts/touch.py b/scripts/touch.py
index 736edc9..ae4974b 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -154,7 +154,7 @@

     bot_class = TouchBot
     for arg in local_args:
-        option, _, value = arg[1:].partition(':')
+        option = arg[1:]
         if arg == '-purge':
             bot_class = PurgeBot
         elif arg.startswith('-'):

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

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

Reply via email to