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

Change subject: [IMPR] Simplify boolean expression and return statement
......................................................................


[IMPR] Simplify boolean expression and return statement

- Don't check for other instances if we already found an item.

Change-Id: I2a59e04bf429daabd2408e0b2b064feb19df373a
---
M pywikibot/page.py
1 file changed, 5 insertions(+), 10 deletions(-)

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



diff --git a/pywikibot/page.py b/pywikibot/page.py
index 79aefc3..fbab94f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4637,14 +4637,12 @@
         @rtype: bool
         """
         if (isinstance(self.target, pywikibot.ItemPage) and
-                isinstance(value, basestring) and
-                self.target.id == value):
-            return True
+                isinstance(value, basestring)):
+            return self.target.id == value
 
         if (isinstance(self.target, pywikibot.WbTime) and
-                not isinstance(value, pywikibot.WbTime) and
-                self.target.year == int(value)):
-            return True
+                not isinstance(value, pywikibot.WbTime)):
+            return self.target.year == int(value)
 
         if (isinstance(self.target, pywikibot.Coordinate) and
                 isinstance(value, basestring)):
@@ -4662,10 +4660,7 @@
             return (abs(self.target.lat - coord_args[0]) <= precision and
                     abs(self.target.lon - coord_args[1]) <= precision)
 
-        if self.target == value:
-            return True
-
-        return False
+        return self.target == value
 
     def has_qualifier(self, qualifier_id, target):
         """

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2a59e04bf429daabd2408e0b2b064feb19df373a
Gerrit-PatchSet: 1
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 <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to