jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[PEP8] Explicit return None if any return statement does not return None

Change-Id: I545cb4be5a32b1bf669d34bfe0752b103d81f7b8
---
M pywikibot/bot.py
M pywikibot/config2.py
M pywikibot/diff.py
M pywikibot/page/_revision.py
M pywikibot/site_detect.py
M pywikibot/textlib.py
M pywikibot/userinterfaces/terminal_interface_base.py
M scripts/fixing_redirects.py
M scripts/maintenance/cache.py
M scripts/replace.py
M scripts/template.py
M scripts/weblinkchecker.py
M scripts/welcome.py
13 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 799fb5a..2e8900e 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1273,7 +1273,7 @@
if oldtext.rstrip() == newtext.rstrip():
pywikibot.output('No changes were needed on %s'
% page.title(as_link=True))
- return
+ return False

self.current_page = page

diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 022d88d..600c130 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -854,6 +854,7 @@
break
else:
return editor
+ return None


# System-level and User-level changes.
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 16c811d..777b260 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -1,6 +1,6 @@
"""Diff module."""
#
-# (C) Pywikibot team, 2014-2020
+# (C) Pywikibot team, 2014-2021
#
# Distributed under the terms of the MIT license.
#
@@ -387,6 +387,7 @@
for pending in range(start, end, step):
if super_hunks[pending].reviewed == Hunk.PENDING:
return pending
+ return None

# TODO: Missing commands (compared to git --patch): edit and search
help_msg = {'y': 'accept this hunk',
diff --git a/pywikibot/page/_revision.py b/pywikibot/page/_revision.py
index 32436b2..9e8eb51 100644
--- a/pywikibot/page/_revision.py
+++ b/pywikibot/page/_revision.py
@@ -94,7 +94,7 @@

if key == 'rollbacktoken':
warning('"rollbacktoken" has been deprecated since MediaWiki 1.24')
- return None
+ return

# raise AttributeError instead of KeyError for backward compatibility
raise AttributeError("'{}' object has no attribute '{}'"
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 084306c..681af7a 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -174,7 +174,7 @@
def api(self) -> Optional[str]:
"""Get api URL."""
if self.server is None or self.scriptpath is None:
- return
+ return None

return self.server + self.scriptpath + '/api.php'

diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 7d15da6..cb6c476 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1361,7 +1361,7 @@
catNamespace = '|'.join(site.namespaces.CATEGORY)
title = oldcat.title(with_ns=False)
if not title:
- return
+ return oldtext
# title might contain regex special characters
title = re.escape(title)
# title might not be capitalized correctly on the wiki
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index b455254..82567cf 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -485,7 +485,7 @@
# Each warning appears twice
# the second time it has a 'message'
if 'message' in record.__dict__:
- return
+ return None

record.__dict__.setdefault('newline', '\n')

diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index 473a6e1..c4b5f9a 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -217,7 +217,7 @@
suggest_help(
unknown_parameters=['-featured'],
additional_text='Option is not available for this site.')
- return False
+ return
else:
gen = genFactory.getCombinedGenerator()
if gen:
diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py
index 1dd1d62..6a8b1b2 100755
--- a/scripts/maintenance/cache.py
+++ b/scripts/maintenance/cache.py
@@ -64,7 +64,7 @@
uniquedesc(entry)
"""
#
-# (C) Pywikibot team, 2014-2020
+# (C) Pywikibot team, 2014-2021
#
# Distributed under the terms of the MIT license.
#
@@ -343,11 +343,13 @@
def not_accessed(entry):
"""Entry has never been accessed."""
if not hasattr(entry, 'stinfo'):
- return
+ return None

if entry.stinfo.st_atime <= entry.stinfo.st_mtime:
return entry

+ return None
+

def incorrect_hash(entry):
"""Incorrect hash."""
@@ -374,6 +376,7 @@
"""Find more than one day old entries."""
if older_than(entry, datetime.timedelta(days=1)):
return entry
+ return None


def recent(entry):
@@ -454,14 +457,14 @@
if output:
output_func = _parse_command(output, 'output')
if output_func is None:
- return False
+ return
else:
output_func = None

if command:
filter_func = _parse_command(command, 'filter')
if filter_func is None:
- return False
+ return
else:
filter_func = None

diff --git a/scripts/replace.py b/scripts/replace.py
index 7f4399c..73b8ce5 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -903,12 +903,12 @@

if len(commandline_replacements) % 2:
pywikibot.error('Incomplete command line pattern replacement pair.')
- return False
+ return

if replacement_file_arg_misplaced:
pywikibot.error(
'-pairsfile used between a pattern replacement pair.')
- return False
+ return

if replacement_file:
try:
@@ -918,13 +918,13 @@
except OSError as e:
pywikibot.error('Error loading {0}: {1}'.format(
replacement_file, e))
- return False
+ return

if len(file_replacements) % 2:
pywikibot.error(
'{0} contains an incomplete pattern replacement pair.'.format(
replacement_file))
- return False
+ return

# Strip BOM from first line
file_replacements[0].lstrip('\uFEFF')
diff --git a/scripts/template.py b/scripts/template.py
index e5570d5..0984554 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -105,7 +105,7 @@

"""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -267,7 +267,7 @@

if not template_names:
pywikibot.bot.suggest_help(missing_parameters=['templates'])
- return False
+ return

if bool(options.get('subst', False)) ^ options.get('remove', False):
for template_name in template_names:
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index ecc2836..ac9fb3b 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -687,7 +687,7 @@
bot.run()
except ImportError:
suggest_help(missing_dependencies=('memento_client',))
- return False
+ return
finally:
waitTime = 0
# Don't wait longer than 30 seconds for threads to finish.
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 0c29ef8..f03fa4d 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -742,7 +742,7 @@
"{} doesn't allow random signature, force disable."
.format(self.site))
globalvar.randomSign = False
- return
+ return None

sign_page = pywikibot.Page(self.site, sign_page_name)
if sign_page.exists():

To view, visit change 672047. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I545cb4be5a32b1bf669d34bfe0752b103d81f7b8
Gerrit-Change-Number: 672047
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged