jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] use @staticmethod for several methods

Change-Id: I3c0cd141d036acba009d74148b694511dfe8c83c
---
M tests/oauth_tests.py
M tests/replacebot_tests.py
M tests/edit_failure_tests.py
M tests/paraminfo_tests.py
M pywikibot/site/_basesite.py
5 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index eec692a..7292efc 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -231,7 +231,8 @@
yield base_path + '?title={}'
yield self.articlepath

- def _build_namespaces(self):
+ @staticmethod
+ def _build_namespaces():
"""Create default namespaces."""
return Namespace.builtin_namespaces()

diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py
index b09abf6..8b1109c 100755
--- a/tests/edit_failure_tests.py
+++ b/tests/edit_failure_tests.py
@@ -8,7 +8,7 @@
These tests use special code 'write = -1' for edit failures.
"""
#
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2023
#
# Distributed under the terms of the MIT license.
#
@@ -148,7 +148,8 @@
with self.assertRaises(PageSaveRelatedError):
item.save()

- def _make_WbMonolingualText_claim(self, repo, text, language):
+ @staticmethod
+ def _make_WbMonolingualText_claim(repo, text, language):
"""Make a WbMonolingualText and set its value."""
claim = pywikibot.page.Claim(repo, 'P271', datatype='monolingualtext')
target = pywikibot.WbMonolingualText(text=text, language=language)
diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index 7546995..4364367 100755
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Test OAuth functionality."""
#
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2023
#
# Distributed under the terms of the MIT license.
#
@@ -24,7 +24,8 @@

oauth = True

- def _get_oauth_tokens(self):
+ @staticmethod
+ def _get_oauth_tokens():
"""Get valid OAuth tokens from environment variables."""
tokens = os.environ.get('PYWIKIBOT_TEST_OAUTH')
return tuple(tokens.split(':')) if tokens is not None else None
diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py
index 13d67afd..f5877f4 100755
--- a/tests/paraminfo_tests.py
+++ b/tests/paraminfo_tests.py
@@ -22,7 +22,8 @@

"""Base class for paraminfo checks."""

- def _get_param_values(self, site, module, parameter):
+ @staticmethod
+ def _get_param_values(site, module, parameter):
"""Perform check that a parameter matches the expected list."""
with skipping(
ValueError,
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py
index 291d9a2..d678c0b 100755
--- a/tests/replacebot_tests.py
+++ b/tests/replacebot_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for the replace script and ReplaceRobot class."""
#
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2023
#
# Distributed under the terms of the MIT license.
#
@@ -86,7 +86,8 @@
self.inputs.append(message)
return 'TESTRUN'

- def _run(self, *args):
+ @staticmethod
+ def _run(*args):
"""Run the :py:obj:`replace.main` with the given args.

It also adds -site and -page parameters:

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3c0cd141d036acba009d74148b694511dfe8c83c
Gerrit-Change-Number: 950204
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged