Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1147773?usp=email )
Change subject: doc: Update documentation
......................................................................
doc: Update documentation
Change-Id: I2260e9dfdaccac52fde2fdd46dfe9b14c0df0524
---
M HISTORY.rst
M pywikibot/page/_user.py
M pywikibot/tools/__init__.py
3 files changed, 27 insertions(+), 4 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/HISTORY.rst b/HISTORY.rst
index cd0b0ab..ac36765 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -329,6 +329,8 @@
only available for :class:`family.WikimediaFamily` families. The
``wikimedia_sites.py`` maintenance script was
removed.
* Add :func:`config.base_dir<config.get_base_dir>` to scripts search path with
:mod:`pwb` wrapper (:phab:`T324287`)
+* Detect range blocks with :meth:`pywikibot.User.is_blocked` and
:meth:`pywikibot.User.getprops` (:phab:`T301282`)
+* Add :func:`tools.is_ip_network` and :meth:`pywikibot.User.is_CIDR`
(:phab:`T301282`)
* :meth:`pywikibot.WbTime.equal_instant` was added (:phab:`T325248`)
* ``revisions`` parameter of :class:`xmlreader.XmlDump` was introduced to
specify parsing method
(:phab:`T340804`)
diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 9f20a8d..1a4ba58 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -1,6 +1,6 @@
"""Object representing a Wiki user."""
#
-# (C) Pywikibot team, 2009-2024
+# (C) Pywikibot team, 2009-2025
#
# Distributed under the terms of the MIT license.
#
@@ -72,6 +72,8 @@
The page does not need to exist for this method to return
True.
+ .. seealso:: :meth:`isAnonymous`
+
:param force: if True, forces reloading the data from API
"""
# T135828: the registration timestamp may be None but the key exists
@@ -79,16 +81,32 @@
and 'registration' in self.getprops(force))
def isAnonymous(self) -> bool: # noqa: N802
- """Determine if the user is editing as an IP address."""
+ """Determine if the user is editing as an IP address.
+
+ .. seealso::
+ - :meth:`isRegistered`
+ - :meth:`is_CIDR`
+ - :func:`tools.is_ip_address`
+ """
return is_ip_address(self.username)
def is_CIDR(self) -> bool: # noqa: N802
- """Determine if the input refers to a range of IP addresses."""
+ """Determine if the input refers to a range of IP addresses.
+
+ .. versionadded:: 9.0
+ .. seealso::
+ - :meth:`isRegistered`
+ - :meth:`isAnonymous`
+ - :func:`tools.is_ip_network`
+ """
return is_ip_network(self.username)
def getprops(self, force: bool = False) -> dict:
"""Return a properties about the user.
+ .. versionchanged:: 9.0
+ detect range blocks
+
:param force: if True, forces reloading the data from API
"""
if force and hasattr(self, '_userprops'):
@@ -127,7 +145,8 @@
"""Determine whether the user is currently blocked.
.. versionchanged:: 7.0
- renamed from :meth:`isBlocked` method,
+ renamed from :meth:`isBlocked` method
+ .. versionchanged:: 9.0
can also detect range blocks.
:param force: if True, forces reloading the data from API
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 2a49960..6eb0fe8 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -92,6 +92,7 @@
.. versionadded:: 6.1
Was renamed from ``is_IP()``.
+ .. seealso:: :func:`is_ip_network`
:param value: value to check
"""
@@ -106,6 +107,7 @@
"""Check if a value is a valid range of IPv4 or IPv6 addresses.
.. versionadded:: 9.0
+ .. seealso:: :func:`is_ip_address`
:param value: value to check
"""
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1147773?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: I2260e9dfdaccac52fde2fdd46dfe9b14c0df0524
Gerrit-Change-Number: 1147773
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]