Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316222

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/22/316222/1

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: newchange
Gerrit-Change-Id: I2a59e04bf429daabd2408e0b2b064feb19df373a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>

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

Reply via email to