Skip to content

Commit

Permalink
[doc] Update ROADMAP.rst and CHANGELOG.rst
Browse files Browse the repository at this point in the history
- add version hints
- PagePilePageGenerator is derived from collections.abc.Generator
  and can be used directly

Change-Id: I215109a473dc2e9c1671d9feb6cc3c734500cbb7
  • Loading branch information
xqt committed Dec 10, 2023
1 parent 5532f67 commit 65ae6e8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
6 changes: 4 additions & 2 deletions ROADMAP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ Current release
Improvements
^^^^^^^^^^^^

* (no changes yet)
* L10N Updates
* Add :class:`pagegenerators.PagePilePageGenerator` (:phab:`T353086`)

Bugfixes
^^^^^^^^

* (no changes yet)
* :func:`pywikibot.input_choice` validates *default* parameter (:phab:`T353097`)
* Remove typing imports from user-config.py file (:phab:`T352965`)

Breaking changes and code cleanups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
10 changes: 6 additions & 4 deletions pywikibot/pagegenerators/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,12 +927,14 @@ def _handle_redirect(self, value: str) -> HANDLER_RETURN_TYPE:
return True

def _handle_pagepile(self, value: str) -> HANDLER_RETURN_TYPE:
"""Handle `-pagepile` argument."""
"""Handle `-pagepile` argument.
.. versionadded:: 9.0
"""
if not value.isnumeric():
raise ValueError(
f'PagePile id must be an int. I was given "{value}"')
pile = PagePilePageGenerator(int(value))
return pile.generator
f'PagePile id must be an int. It was given "{value}"')
return PagePilePageGenerator(int(value))

def handle_args(self, args: Iterable[str]) -> list[str]:
"""Handle command line arguments and return the rest as a list.
Expand Down
1 change: 0 additions & 1 deletion pywikibot/pagegenerators/_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,6 @@ class PagePilePageGenerator(GeneratorWrapper):
.. seealso:: https://pagepile.toolforge.org/
.. versionadded:: 9.0
subclassed from :class:`tools.collections.GeneratorWrapper`
"""

def __init__(self, id: int):
Expand Down
11 changes: 9 additions & 2 deletions pywikibot/site/_namespace.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Objects representing Namespaces of MediaWiki site."""
#
# (C) Pywikibot team, 2008-2022
# (C) Pywikibot team, 2008-2023
#
# Distributed under the terms of the MIT license.
#
Expand Down Expand Up @@ -53,7 +53,11 @@ def canonical(self) -> str:


class MetaNamespace(ABCMeta):
"""Metaclass for Namespace attribute settings."""

"""Metaclass for Namespace attribute settings.
.. versionadded:: 9.0
"""

def __new__(cls, name, bases, dic):
"""Set Namespace.FOO to BuiltinNamespace.FOO for each builtin ns."""
Expand All @@ -79,6 +83,9 @@ class Namespace(Iterable, ComparableMixin, metaclass=MetaNamespace):
If only one of canonical_name and custom_name are available, both
properties will have the same value.
.. versionchanged:: 9.0
metaclass from :class:`MetaNamespace`
"""

def __init__(self, id,
Expand Down
8 changes: 8 additions & 0 deletions scripts/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Scripts Changelog
=================

9.0.0
-----

category_redirect
~~~~~~~~~~~~~~~~~

* provide category_redirect categories for all WM sites (:phab:`T348914`)

8.5.0
-----

Expand Down
3 changes: 1 addition & 2 deletions tests/pagegenerators_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ class PagePilePageGeneratorTestCase(TestCase):
def test_PagePilePageGenerator(self):
"""Test PagePilePageGenerator."""
gen = pagegenerators.PagePilePageGenerator(id=53158)
pages = list(gen.generator)
self.assertLength(pages, 215)
self.assertLength(list(gen), 215)
self.assertEqual(gen.site, pywikibot.Site('wikipedia:ro'))


Expand Down

0 comments on commit 65ae6e8

Please sign in to comment.