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): """