jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1224020?usp=email )
Change subject: tests: update precommit-hooks
......................................................................
tests: update precommit-hooks
also solve some SIG305 issues
Change-Id: Id2410ed5a38470f36360c3a76e6b2e6111e46c64
---
M .pre-commit-config.yaml
M pyproject.toml
M pywikibot/comms/http.py
M pywikibot/site/_datasite.py
M pywikibot/tools/_deprecate.py
5 files changed, 43 insertions(+), 38 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 74a65c6..9e105bd 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -92,7 +92,7 @@
- id: isort
exclude: ^pwb\.py$
- repo: https://github.com/jshwi/docsig
- rev: v0.72.2
+ rev: v0.74.1
hooks:
- id: docsig
exclude: ^(tests|scripts)
diff --git a/pyproject.toml b/pyproject.toml
index 6992c45..559b73b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -164,6 +164,7 @@
"SIG202",
"SIG203",
"SIG301",
+ "SIG305",
"SIG402",
"SIG404",
"SIG501",
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 281cf16..6dd8923 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -25,7 +25,7 @@
Cookies are lazy loaded when logging to site.
"""
#
-# (C) Pywikibot team, 2007-2025
+# (C) Pywikibot team, 2007-2026
#
# Distributed under the terms of the MIT license.
#
@@ -269,11 +269,11 @@
:meth:`family.Family.base_url` method.
:param site: The Site to connect to
- :param uri: the URI to retrieve
+ :param uri: The URI to retrieve
:keyword CodecInfo or str or None charset: Either a valid charset
(usable for `str.decode()`) or None to automatically chose the
charset from the returned header (defaults to latin-1).
- :keyword str | None protocol: a url scheme
+ :keyword str | None protocol: A url scheme
:return: The received data Response
"""
kwargs.setdefault('verify', site.verify_SSL_certificate())
@@ -293,8 +293,8 @@
def get_authentication(uri: str) -> tuple[str, str] | None:
"""Retrieve authentication token.
- :param uri: the URI to access
- :return: authentication token
+ :param uri: The URI to access
+ :return: Authentication token
"""
parsed_uri = urlparse(uri)
netloc_parts = parsed_uri.netloc.split('.')
@@ -375,7 +375,7 @@
:param uri: URL to send
:param method: HTTP method of the request (default: GET)
- :param headers: dictionary of headers of the request
+ :param headers: Dictionary of headers of the request
:param default_error_handling: Use default error handling
:param use_fake_user_agent: Set to True to use fake UA, False to use
pywikibot's UA, str to specify own UA. This behaviour might be
@@ -385,7 +385,7 @@
to automatically chose the charset from the returned header (defaults
to latin-1)
:type charset: CodecInfo, str, None
- :keyword verify: verify the SSL certificate (default is True)
+ :keyword verify: Verify the SSL certificate (default is True)
:type verify: bool or path to certificates
:keyword callbacks: Methods to call once data is fetched
:type callbacks: list of callable
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index 6cb87db..7b66e93 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -1,6 +1,6 @@
"""Objects representing API interface to Wikibase site."""
#
-# (C) Pywikibot team, 2012-2025
+# (C) Pywikibot team, 2012-2026
#
# Distributed under the terms of the MIT license.
#
@@ -170,7 +170,7 @@
return None
- def loadcontent(self, identification, *props):
+ def loadcontent(self, identification: dict[str, Any], *props):
"""Fetch the current content of a Wikibase item.
This is called loadcontent since wbgetentities does not support
@@ -178,8 +178,7 @@
actual loadrevisions.
:param identification: Parameters used to identify the page(s)
- :type identification: dict
- :param props: the optional properties to fetch.
+ :param props: The optional properties to fetch.
"""
params = merge_unique_dicts(identification, action='wbgetentities',
# TODO: When props is empty it results in
@@ -203,9 +202,9 @@
.. note:: Pages will be iterated in a different order than in
the underlying pagelist.
- :param pagelist: an iterable that yields either WikibaseEntity
+ :param pagelist: An iterable that yields either WikibaseEntity
objects, or Page objects linked to an ItemPage.
- :param groupsize: how many pages to query at a time
+ :param groupsize: How many pages to query at a time
"""
if not hasattr(self, '_entity_namespaces'):
self._cache_entity_namespaces()
@@ -299,7 +298,7 @@
:param entity: Page to edit, or dict with API parameters
to use for entity identification.
- :param data: data updates
+ :param data: Data updates
:param bot: Whether to mark the edit as a bot edit.
:keyword int baserevid: The numeric identifier for the revision
@@ -783,7 +782,7 @@
def set_redirect_target(self, from_item, to_item, bot: bool = True):
"""Make a redirect to another item.
- :param to_item: title of target item.
+ :param to_item: Title of target item.
:type to_item: pywikibot.ItemPage
:param from_item: Title of the item to be redirected.
:type from_item: pywikibot.ItemPage
@@ -840,16 +839,16 @@
.. seealso:: `wbparsevalue API
<https://www.wikidata.org/w/api.php?action=help&modules=wbparsevalue>`_
- :param datatype: datatype of the values being parsed. Refer the
+ :param datatype: Data type of the values being parsed. Refer the
API for a valid datatype.
- :param values: list of values to be parsed
- :param options: any additional options for wikibase parser
+ :param values: List of values to be parsed
+ :param options: Any additional options for wikibase parser
(for time, 'precision' should be specified)
- :param language: code of the language to parse the value in
- :param validate: whether parser should provide data validation as well
- as parsing
+ :param language: The code of the language to parse the value in
+ :param validate: Whether parser should provide data validation
+ as well as parsing
:return: list of parsed values
- :raises ValueError: parsing failed due to some invalid input values
+ :raises ValueError: Parsing failed due to some invalid input values
"""
params = {
'action': 'wbparsevalue',
@@ -1082,18 +1081,21 @@
@need_right('edit')
@need_extension('WikibaseLexeme')
- def edit_form_elements(self, form, data, *, bot: bool = True,
- baserevid=None) -> dict:
+ def edit_form_elements(
+ self,
+ form: pywikibot.LexemeForm,
+ data: dict[str, Any],
+ *,
+ bot: bool = True,
+ baserevid: int | None = None
+ ) -> dict:
"""Edit lexeme form elements.
:param form: Form
- :type form: pywikibot.LexemeForm
- :param data: data updates
- :type data: dict
- :keyword bot: Whether to mark the edit as a bot edit
- :keyword baserevid: Base revision id override, used to detect
+ :param data: Data updates
+ :param bot: Whether to mark the edit as a bot edit
+ :param baserevid: Base revision id override, used to detect
conflicts.
- :type baserevid: long
:return: New form data
"""
params = {
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index f67f91d..16b0e1d 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -19,7 +19,7 @@
deprecation decorators moved to _deprecate submodule
"""
#
-# (C) Pywikibot team, 2008-2025
+# (C) Pywikibot team, 2008-2026
#
# Distributed under the terms of the MIT license.
#
@@ -65,7 +65,7 @@
:param obj: An object being decorated
:type obj: object
- :param stacklevel: level to use
+ :param stacklevel: Stack level to use
"""
if hasattr(obj, '__full_name__'):
return
@@ -209,12 +209,14 @@
.. versionchanged:: 8.2
*warning_class* and *since* are keyword-only parameters.
- :param name: the name of the deprecated object
- :param instead: suggested replacement for the deprecated object
- :param depth: depth + 1 will be used as stacklevel for the warnings
- :param warning_class: a warning class (category) to be used,
+ :param name: The name of the deprecated object
+ :param instead: Suggested replacement for the deprecated object
+ :param depth: *depth* + 1 will be used as stacklevel for the
+ warnings
+ :param warning_class: A warning class (category) to be used,
defaults to FutureWarning
- :param since: a version string when the method or function was deprecated
+ :param since: A version string when the method or function was
+ deprecated
"""
msg = _build_msg_string(instead, since)
if warning_class is None:
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1224020?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: Id2410ed5a38470f36360c3a76e6b2e6111e46c64
Gerrit-Change-Number: 1224020
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]