diff --git a/ROADMAP.rst b/ROADMAP.rst index 756468cfce..d151e048a9 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -11,6 +11,8 @@ Current Release Changes **Breaking changes and code cleanups** +* 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes were removed in favour of + :attr:`use_redirects` attribute * Python 3.7 support was dropped (:phab:`T378893`) @@ -95,8 +97,6 @@ Pending removal in Pywikibot 10 * 7.2.0: ``tb`` parameter of :func:`exception()` function was renamed to ``exc_info`` * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` parameter of :func:`XMLDumpPageGenerator` (:phab:`T306134`) -* 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in favour of - :attr:`use_redirects` attribute * 7.2.0: :func:`tools.formatter.color_format` is deprecated and will be removed * 7.1.0: Unused ``get_redirect`` parameter of :meth:`Page.getOldVersion()` will be removed * 7.0.0: User.isBlocked() method is renamed to is_blocked for consistency diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 6e9efa8476..952848e871 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -55,11 +55,6 @@ class is mainly used for bots which work with Wikibase or together subclasses :class:`CurrentPageBot` and automatically defines the summary when :meth:`put_current` is used. -.. deprecated:: 7.2 - The bot classes :class:`RedirectPageBot` and - :class:`NoRedirectPageBot` are deprecated. Use - :attr:`use_redirects` attribute instead. - .. deprecated:: 9.2 The functions :func:`critical()` @@ -78,6 +73,11 @@ class is mainly used for bots which work with Wikibase or together and ``WARNING`` imported from :mod:`logging` module are deprecated within this module. Import them directly. These functions can also be used as :mod:`pywikibot` members. + +.. versionremoved:: 10.0 + The bot classes :class:`RedirectPageBot` and + :class:`NoRedirectPageBot` are deprecated. Use + :attr:`use_redirects` attribute instead. """ # # (C) Pywikibot team, 2008-2024 @@ -105,7 +105,6 @@ class is mainly used for bots which work with Wikibase or together 'BaseBot', 'Bot', 'ConfigParserBot', 'SingleSiteBot', 'MultipleSitesBot', 'CurrentPageBot', 'AutomaticTWSummaryBot', 'ExistingPageBot', 'FollowRedirectPageBot', 'CreatingPageBot', - 'RedirectPageBot', 'NoRedirectPageBot', 'WikidataBot', ) @@ -189,7 +188,7 @@ class is mainly used for bots which work with Wikibase or together from pywikibot.logging import stdout as _stdout from pywikibot.logging import warning as _warning from pywikibot.throttle import Throttle -from pywikibot.tools import issue_deprecation_warning, redirect_func, strtobool +from pywikibot.tools import redirect_func, strtobool from pywikibot.tools._logging import LoggingFormatter @@ -1937,56 +1936,6 @@ def skip_page(self, page: pywikibot.page.BasePage) -> bool: return super().skip_page(page) -class RedirectPageBot(CurrentPageBot): # pragma: no cover - - """A RedirectPageBot class which only treats redirects. - - .. deprecated:: 7.2 - use BaseBot attribute - :attr:`use_redirects = True` instead - """ - - def __init__(self, *args, **kwargs): - """Deprecate RedirectPageBot.""" - issue_deprecation_warning('RedirectPageBot', - "BaseBot attribute 'use_redirects = True'", - since='7.2.0') - super().__init__(*args, **kwargs) - - def skip_page(self, page: pywikibot.page.BasePage) -> bool: - """Treat only redirect pages and handle IsNotRedirectPageError.""" - if not page.isRedirectPage(): - _warning(f'Page {page} on {page.site} is skipped because it is' - ' not a redirect') - return True - return super().skip_page(page) - - -class NoRedirectPageBot(CurrentPageBot): # pragma: no cover - - """A NoRedirectPageBot class which only treats non-redirects. - - .. deprecated:: 7.2 - use BaseBot attribute - :attr:`use_redirects = False` instead - """ - - def __init__(self, *args, **kwargs): - """Deprecate NoRedirectPageBot.""" - issue_deprecation_warning('NoRedirectPageBot', - "BaseBot attribute 'use_redirects = False'", - since='7.2.0') - super().__init__(*args, **kwargs) - - def skip_page(self, page: pywikibot.page.BasePage) -> bool: - """Treat only non-redirect pages and handle IsRedirectPageError.""" - if page.isRedirectPage(): - _warning(f'Page {page} on {page.site} is skipped because it is' - ' a redirect') - return True - return super().skip_page(page) - - class WikidataBot(Bot, ExistingPageBot): """Generic Wikidata Bot to be subclassed.