jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1155605?usp=email )
Change subject: IMPR: use keyword only args in some private methods
......................................................................
IMPR: use keyword only args in some private methods
Change-Id: I3566ae31b9dedb184122d605c53ec4bfd68d4d00
---
M pywikibot/cosmetic_changes.py
M pywikibot/data/api/_optionset.py
M tests/api_tests.py
3 files changed, 6 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 9244283..57b39ad 100644
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -203,7 +203,7 @@
MATCH = 3
-def _format_isbn_match(match: Match[str], strict: bool = True) -> str:
+def _format_isbn_match(match: Match[str], *, strict: bool = True) -> str:
"""Helper function to validate and format a single matched ISBN."""
if not stdnum_isbn:
raise NotImplementedError(
@@ -221,7 +221,7 @@
return stdnum_isbn.format(isbn)
-def _reformat_ISBNs(text: str, strict: bool = True) -> str:
+def _reformat_ISBNs(text: str, *, strict: bool = True) -> str:
"""Helper function to normalise ISBNs in text.
:raises Exception: Invalid ISBN encountered when strict enabled
diff --git a/pywikibot/data/api/_optionset.py b/pywikibot/data/api/_optionset.py
index aeabc0c..1c88117 100644
--- a/pywikibot/data/api/_optionset.py
+++ b/pywikibot/data/api/_optionset.py
@@ -1,6 +1,6 @@
"""Object representing boolean API option."""
#
-# (C) Pywikibot team, 2015-2024
+# (C) Pywikibot team, 2015-2025
#
# Distributed under the terms of the MIT license.
#
@@ -54,7 +54,7 @@
if data:
self.from_dict(data)
- def _set_site(self, site, module: str, param: str,
+ def _set_site(self, site, module: str, param: str, *,
clear_invalid: bool = False) -> None:
"""Set the site and valid names.
diff --git a/tests/api_tests.py b/tests/api_tests.py
index d2944cb..f0e3ca1 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -327,7 +327,8 @@
with self.assertRaises(KeyError):
options._set_site(self.get_site(), 'recentchanges', 'show')
self.assertLength(options, 2)
- options._set_site(self.get_site(), 'recentchanges', 'show', True)
+ options._set_site(self.get_site(), 'recentchanges', 'show',
+ clear_invalid=True)
self.assertLength(options, 1)
with self.assertRaises(TypeError):
options._set_site(self.get_site(), 'recentchanges', 'show')
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1155605?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: I3566ae31b9dedb184122d605c53ec4bfd68d4d00
Gerrit-Change-Number: 1155605
Gerrit-PatchSet: 1
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]