jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1091888?usp=email )
Change subject: doc: Update ROADMAP.rst and documentation of other files
......................................................................
doc: Update ROADMAP.rst and documentation of other files
Change-Id: I1d5211aa9f8ddade6bbfbb35459994336de7b74b
---
M ROADMAP.rst
M pywikibot/page/_basepage.py
M pywikibot/site/_generators.py
3 files changed, 39 insertions(+), 15 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 7ef2387..f76a3c3 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,9 @@
Current Release Changes
=======================
+* Implement param *with_sort_key* in :meth:`page.BasePage.categories`
(:phab:`T75561`)
* Python 3.7 support will be discontinued and probably this is the last
version supporting it
+* Add :meth:`page.BasePage.get_revision` method
* Retry :meth:`data.sparql.SparqlQuery.query` on internal server error (500)
(:phab:`T378788`)
* Extract
:meth:`APISite.linktrail()<pywikibot.site._apisite.APISite.linktrail>`
for hr-wiki (:phab:`T378787`)
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 91e8c7b..335f0e3 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -443,6 +443,10 @@
) -> pywikibot.page.Revision:
"""Return an old revision of this page.
+ .. versionadded:: 9.6
+ .. seealso:: :meth:`getOldVersion`
+
+
:param oldid: The revid of the revision desired.
:param content: if True, retrieve the content of the revision
(default False)
@@ -456,6 +460,8 @@
def getOldVersion(self, oldid, force: bool = False) -> str:
"""Return text of an old revision of this page.
+ .. seealso:: :meth:`get_revision`
+
:param oldid: The revid of the revision desired.
"""
return self.get_revision(oldid, content=True, force=force).text
@@ -1730,12 +1736,20 @@
) -> Iterable[pywikibot.Page]:
"""Iterate categories that the article is in.
- :param with_sort_key: if True, include the sort key in each Category.
+ .. versionchanged:: 2.0
+ *with_sort_key* parameter is not supported and a
+ NotImplementedError is raised if set.
+ .. versionchanged:: 9.6
+ *with_sort_key* parameter is supported.
+ .. seealso:: :meth:`Site.pagecategories()
+ <pywikibot.site._generators.GeneratorsMixin.pagecategories>`
+
+ :param with_sort_key: if True, include the sort key in
+ each Category.
:param total: iterate no more than this number of pages in total
- :param content: if True, retrieve the content of the current version
- of each category description page (default False)
+ :param content: if True, retrieve the content of the current
+ version of each category description page (default False)
:return: a generator that yields Category objects.
- :rtype: generator
"""
# Data might have been preloaded
# Delete cache if content is needed and elements have no content
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 4d1ecc6..0de2182 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -461,12 +461,19 @@
) -> Iterable[pywikibot.Page]:
"""Iterate categories to which page belongs.
- .. seealso:: :api:`Categories`
+ .. versionadded:: 9.6
+ the *with_sort_key* parameter.
- :param with_sort_key: if True, include the sort key in each Category
- :param content: if True, load the current content of each iterated page
- (default False); note that this means the contents of the
- category description page, not the pages contained in the category
+ .. seealso::
+ - :meth:`page.BasePage.categories`
+ - :api:`Categories`
+
+ :param with_sort_key: if True, include the sort key in each
+ Category
+ :param content: if True, load the current content of each
+ iterated page default False); note that this means the
+ contents of the category description page, not the pages
+ contained in the category
"""
clargs: dict[str, Any] = {}
if hasattr(page, '_pageid'):
@@ -474,6 +481,7 @@
else:
clargs['titles'] = page.title(
with_section=False).encode(self.encoding())
+
if with_sort_key:
page_dict = next(iter(self._generator(
api.PropertyGenerator,
@@ -488,12 +496,12 @@
for cat_dict in page_dict.get('categories', [])
)
return self.preloadpages(cats) if content else cats
- else:
- return self._generator(api.PageGenerator,
- type_arg='categories',
- total=total,
- g_content=content,
- **clargs)
+
+ return self._generator(api.PageGenerator,
+ type_arg='categories',
+ total=total,
+ g_content=content,
+ **clargs)
def pageimages(
self,
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1091888?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: I1d5211aa9f8ddade6bbfbb35459994336de7b74b
Gerrit-Change-Number: 1091888
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]