jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1307552?usp=email )
Change subject: doc: add missing return type annotations to several functions
......................................................................
doc: add missing return type annotations to several functions
Change-Id: I1fb07d191873cd0414d86cb7f4688ca9550dcb12
---
M pywikibot/data/api/_generators.py
M pywikibot/scripts/generate_family_file.py
M tests/citoid_tests.py
M tests/interwikibot_tests.py
M tests/site_tests.py
M tests/tools_deprecate_tests.py
6 files changed, 17 insertions(+), 17 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/data/api/_generators.py
b/pywikibot/data/api/_generators.py
index bb1b5f7..42cce31 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -77,7 +77,7 @@
return getattr(self, '_filter_func', type(self)._filter_func)
@filter_func.setter
- def filter_func(self, func: Callable[[Any], bool] | None):
+ def filter_func(self, func: Callable[[Any], bool] | None) -> None:
"""Set a filter function to apply to items before yielding.
.. version-added:: 10.4
diff --git a/pywikibot/scripts/generate_family_file.py
b/pywikibot/scripts/generate_family_file.py
index 6953dd2..160b053 100755
--- a/pywikibot/scripts/generate_family_file.py
+++ b/pywikibot/scripts/generate_family_file.py
@@ -98,7 +98,7 @@
self.langs = [] # [Wiki('https://wiki/$1'), ...]
@staticmethod
- def show(*args, **kwargs):
+ def show(*args, **kwargs) -> None:
"""Wrapper around print to be mocked in tests."""
print(*args, **kwargs) # pragma: no cover
diff --git a/tests/citoid_tests.py b/tests/citoid_tests.py
index d6d9279..74a72eb 100755
--- a/tests/citoid_tests.py
+++ b/tests/citoid_tests.py
@@ -24,7 +24,7 @@
code = 'test'
login = False
- def test_citoid_positive(self):
+ def test_citoid_positive(self) -> None:
"""Test citoid script."""
client = citoid.CitoidClient(self.site)
resp = client.get_citation(
@@ -43,7 +43,7 @@
datetime.datetime.now().strftime('%Y-%m-%d')
)
- def test_citoid_no_config(self):
+ def test_citoid_no_config(self) -> None:
"""Test citoid script with no citoid endpoint configured."""
client = citoid.CitoidClient(pywikibot.Site('wikiquote:pl'))
with self.assertRaisesRegex(
@@ -55,7 +55,7 @@
'https://ro.wikipedia.org/wiki/România'
)
- def test_citoid_no_valid_format(self):
+ def test_citoid_no_valid_format(self) -> None:
"""Test citoid script with invalid format provided."""
client = citoid.CitoidClient(self.site)
with self.assertRaisesRegex(ValueError, 'Invalid format mediawiki2'):
diff --git a/tests/interwikibot_tests.py b/tests/interwikibot_tests.py
index b0a0e8d..6d978f4 100755
--- a/tests/interwikibot_tests.py
+++ b/tests/interwikibot_tests.py
@@ -33,7 +33,7 @@
site = DrySite(code, fam, None)
return site
- def test_hint_options(self):
+ def test_hint_options(self) -> None:
"""Test -hint and -hintfile options."""
iwc = interwiki.InterwikiBotConfig()
self.assertIsInstance(iwc.hints, list)
@@ -44,7 +44,7 @@
iwc.readOptions(option)
self.assertLength(iwc.hints, 8)
- def test_ignore_option(self):
+ def test_ignore_option(self) -> None:
"""Test -ignore and -ignorefile options."""
iwc = interwiki.InterwikiBotConfig()
self.assertIsInstance(iwc.ignore, list)
@@ -54,7 +54,7 @@
iwc.readOptions('-ignore:Foo,Bar,Baz')
self.assertLength(iwc.ignore, 8)
- def test_skipfile_option(self):
+ def test_skipfile_option(self) -> None:
"""Test -skipfile options."""
iwc = interwiki.InterwikiBotConfig()
self.assertIsInstance(iwc.skip, set)
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 473c5d4..6e6fd2b 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -811,17 +811,17 @@
return None
@classmethod
- def setUpClass(cls):
+ def setUpClass(cls) -> None:
"""Use sandbox page for tests."""
super().setUpClass()
cls.page = pywikibot.Page(cls.site, 'Sandbox')
- def setUp(self):
+ def setUp(self) -> None:
"""Patch has_right method."""
super().setUp()
self.patch(self.site, 'has_right', lambda right: True)
- def test_missing_rights(self):
+ def test_missing_rights(self) -> None:
"""Test missing rollback right."""
self.patch(self.site, 'has_right', lambda right: False)
with self.assertRaisesRegex(
@@ -831,7 +831,7 @@
):
self.site.rollbackpage(self.page, pageid=4711)
- def test_exceptions(self):
+ def test_exceptions(self) -> None:
"""Test rollback exceptions."""
with self.assertRaisesRegex(
ValueError,
@@ -849,7 +849,7 @@
NoPageError, r"Page -1 \(pageid\) doesn't exist\."):
self.site.rollbackpage(pageid=-1)
- def test_rollback_simulation(self):
+ def test_rollback_simulation(self) -> None:
"""Test rollback in simulate mode."""
result = self.site.rollbackpage(self.page)
self.assertIsInstance(result, dict)
diff --git a/tests/tools_deprecate_tests.py b/tests/tools_deprecate_tests.py
index 55c1202..141d625 100755
--- a/tests/tools_deprecate_tests.py
+++ b/tests/tools_deprecate_tests.py
@@ -74,7 +74,7 @@
@deprecated()
-def deprecated_func_docstring(foo=None):
+def deprecated_func_docstring(foo=None) -> None:
"""DEPRECATED. Deprecated function."""
@@ -85,7 +85,7 @@
@deprecated
-def deprecated_func2_docstring(foo=None):
+def deprecated_func2_docstring(foo=None) -> None:
"""DEPRECATED, don't use this. Deprecated function."""
@@ -114,12 +114,12 @@
@deprecated
-def deprecated_func_docstring_arg(foo=None):
+def deprecated_func_docstring_arg(foo=None) -> None:
""":param foo: Foo. DEPRECATED."""
@deprecated
-def deprecated_func_docstring_arg2(foo=None):
+def deprecated_func_docstring_arg2(foo=None) -> None:
"""DEPRECATED.
:param foo: Foo. DEPRECATED.
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1307552?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1fb07d191873cd0414d86cb7f4688ca9550dcb12
Gerrit-Change-Number: 1307552
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]