jenkins-bot has submitted this change and it was merged.

Change subject: code cleanup
......................................................................


code cleanup

- remove obsolete NothingFound class. This was previously used for compat's
  -untagged option which retrieved image informations from toolserver
- remove nothing list and use strip() method instead to find empty descriptions
- remove return values in checkStep method. It is superfluous to "continue" a
  loop as a last statement.

Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
---
M scripts/checkimages.py
1 file changed, 9 insertions(+), 18 deletions(-)

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



diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 516efda..f478b9b 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -526,11 +526,6 @@
     """Log is full and the Bot cannot add other data to prevent Errors."""
 
 
-class NothingFound(pywikibot.Error):
-
-    """Regex returned [] instead of results."""
-
-
 def printWithTimeZone(message):
     """Print the messages followed by the TimeZone encoded correctly."""
     if message[-1] != ' ':
@@ -1471,9 +1466,6 @@
 
     def checkStep(self):
         """Check a single file page."""
-        # nothing = Defining an empty image description
-        nothing = ['', ' ', '  ', '   ', '\n', '\n ', '\n  ', '\n\n', '\n \n',
-                   ' \n', ' \n ', ' \n \n']
         # something = Minimal requirements for an image description.
         # If this fits, no tagging will take place
         # (if there aren't other issues)
@@ -1511,11 +1503,11 @@
         except pywikibot.NoPage:
             pywikibot.output(u"Skipping %s because it has been deleted."
                              % self.imageName)
-            return True
+            return
         except pywikibot.IsRedirectPage:
             pywikibot.output(u"Skipping %s because it's a redirect."
                              % self.imageName)
-            return True
+            return
         # Delete the fields where the templates cannot be loaded
         regex_nowiki = re.compile(r'<nowiki>(.*?)</nowiki>', re.DOTALL)
         regex_pre = re.compile(r'<pre>(.*?)</pre>', re.DOTALL)
@@ -1525,7 +1517,7 @@
         # in the image the original text will be reloaded, don't worry).
         if self.isTagged():
             printWithTimeZone(u'%s is already tagged...' % self.imageName)
-            return True
+            return
 
         # something is the array with {{, MIT License and so on.
         for a_word in something:
@@ -1538,7 +1530,7 @@
         (license_found, hiddenTemplateFound) = self.smartDetection()
         # Here begins the check block.
         if brackets and license_found:
-            return True
+            return
         elif delete:
             pywikibot.output(u"%s is not a file!" % self.imageName)
             if not di:
@@ -1555,8 +1547,8 @@
                                                            textlink=True)}
             head = dih
             self.report(canctext, self.imageName, notification, head)
-            return True
-        elif self.imageCheckText in nothing:
+            return
+        elif not self.imageCheckText.strip():  # empty image description
             pywikibot.output(
                 u"The file's description for %s does not contain a license "
                 u" template!" % self.imageName)
@@ -1567,7 +1559,7 @@
             head = nh
             self.report(self.unvertext, self.imageName, notification, head,
                         smwl)
-            return True
+            return
         else:
             pywikibot.output(u"%s has only text and not the specific 
license..."
                              % self.imageName)
@@ -1578,7 +1570,7 @@
             head = nh
             self.report(self.unvertext, self.imageName, notification, head,
                         smwl)
-            return True
+            return
 
 
 def main(*args):
@@ -1769,8 +1761,7 @@
             if duplicatesActive:
                 if not Bot.checkImageDuplicated(duplicates_rollback):
                     continue
-            if Bot.checkStep():
-                continue
+            Bot.checkStep()
 
         if repeat:
             pywikibot.output(u"Waiting for %s seconds," % time_sleep)

-- 
To view, visit https://gerrit.wikimedia.org/r/263361
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
Pywikibot-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to