jenkins-bot submitted this change.
[R1705] Removal of unnecessary else / elif usage after return
Bug: T277888
Change-Id: Idd95ef2bdde0b0bd33075e093aba63ca1757cd7e
---
M pywikibot/data/api.py
M pywikibot/page/_collections.py
M scripts/checkimages.py
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index dac4d9d..576bcec 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -533,10 +533,9 @@
self.fetch({key})
if key in self._paraminfo:
return self._paraminfo[key]
- elif '+' not in key:
+ if '+' not in key:
return self._paraminfo['query+' + key]
- else:
- raise KeyError(key)
+ raise KeyError(key)
def __contains__(self, key) -> bool:
"""Return whether the key is valid."""
@@ -1132,11 +1131,10 @@
"""
if isinstance(value, datetime.datetime):
return value.strftime(pywikibot.Timestamp.ISO8601Format)
- elif isinstance(value, pywikibot.page.BasePage):
+ if isinstance(value, pywikibot.page.BasePage):
assert(value.site == self.site)
return value.title(with_section=False)
- else:
- return str(value)
+ return str(value)
def __getitem__(self, key):
"""Implement dict interface."""
diff --git a/pywikibot/page/_collections.py b/pywikibot/page/_collections.py
index a943148..1880232 100644
--- a/pywikibot/page/_collections.py
+++ b/pywikibot/page/_collections.py
@@ -390,14 +390,13 @@
def _extract_json(cls, obj):
if isinstance(obj, pywikibot.page.SiteLink):
return obj.toJSON()
- elif isinstance(obj, pywikibot.page.BaseLink):
+ if isinstance(obj, pywikibot.page.BaseLink):
db_name = cls.getdbName(obj.site)
return {'site': db_name, 'title': obj.title}
- elif isinstance(obj, pywikibot.page.Page):
+ if isinstance(obj, pywikibot.page.Page):
db_name = cls.getdbName(obj.site)
return {'site': db_name, 'title': obj.title()}
- else:
- return obj
+ return obj
@classmethod
def normalizeData(cls, data) -> dict:
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 61a0402..95c1086 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -595,9 +595,8 @@
if results:
luser = results[0]
return luser
- else:
- # we can't find the user, report the problem to the bot
- return upBotArray[0]
+ # we can't find the user, report the problem to the bot
+ return upBotArray[0]
def tag_image(self, put=True) -> bool:
"""Add template to the Image page and find out the uploader."""
To view, visit change 688316. To unsubscribe, or for help writing mail filters, visit settings.