jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1150499?usp=email )
Change subject: [doc] Fix documentation of Page.getDeletedRevision()
......................................................................
[doc] Fix documentation of Page.getDeletedRevision()
Bug: T331422
Change-Id: Ia956a89ba7174311ec4624902a6ee99870ca0b73
---
M pywikibot/page/_basepage.py
1 file changed, 32 insertions(+), 6 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index f61408f..58ede58 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -12,7 +12,7 @@
from contextlib import suppress
from itertools import islice
from textwrap import shorten, wrap
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any, NoReturn
from urllib.parse import quote_from_bytes
from warnings import warn
@@ -2079,16 +2079,42 @@
timestamp,
content: bool = False,
**kwargs
- ) -> list:
+ ) -> dict[str, Any] | list[NoReturn]:
"""Return a particular deleted revision by timestamp.
+ Gives a dictionary with `revid`, `parentid`, `user`, `timestamp`,
+ and `comment` as keys like this:
+
+ .. code:: Python
+
+ {'revid': 658621, 'parentid': 0, 'user': 'Pywikibot-test',
+ 'timestamp': '2025-05-24T11:01:25Z',
+ 'comment': 'Pywikibot unit test'}
+
+ If *content* is True, a `slots` key is added which holds
+ additional information of the content like:
+
+ .. code:: Python
+
+ 'slots': {
+ 'main': {
+ 'contentmodel': 'wikitext',
+ 'contentformat': 'text/x-wiki',
+ '*': 'Pywikibot deletion test.'
+ }
+ }
+
+ .. caution::
+ If *timestamp* is not found, an empty **list** is given.
+
.. seealso:: :meth:`APISite.deletedrevs()
<pywikibot.site._generators.GeneratorsMixin.deletedrevs>`
- :return: a list of [date, editor, comment, text, restoration
- marker]. text will be None, unless content is True (or has
- been retrieved earlier). If timestamp is not found, returns
- empty list.
+ :param timestamp: Timestamp of the deleted revision
+ :param content: If True, give also the content of the deleted
+ revision.
+ :return: a dictionary information about the deleted revision. If
+ timestamp is not found, an empty list is given.
"""
if hasattr(self, '_deletedRevs') \
and timestamp in self._deletedRevs \
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1150499?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: Ia956a89ba7174311ec4624902a6ee99870ca0b73
Gerrit-Change-Number: 1150499
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Bináris <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]