JJMC89 has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100501?usp=email )
Change subject: remove pywikibot.backports.importlib_metadata
......................................................................
remove pywikibot.backports.importlib_metadata
Bug: T378893
Change-Id: I00fcd83eec2e46cc9a62fdb0049c76f7a315f733
---
M ROADMAP.rst
M pywikibot/backports.py
2 files changed, 2 insertions(+), 7 deletions(-)
Approvals:
JJMC89: Verified; Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 5db0642..f7f45ad 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -26,7 +26,8 @@
* ``tools.formatter.color_format()`` was removed; the new color literals can be used instead
* RedirectPageBot and NoRedirectPageBot bot classes were removed in favour of
:attr:`use_redirects<bot.BaseBot.use_redirects>` attribute
-* Python 3.7 support was dropped (:phab:`T378893`)
+* Python 3.7 support was dropped (:phab:`T378893`), including *importlib_metadata* of
+ :mod:`backports`
Current Deprecations
@@ -34,7 +35,6 @@
* 10.0.0: *includeredirects* parameter of :func:`pagegenerators.AllpagesPageGenerator` and
:func:`pagegenerators.PrefixingPageGenerator` is deprecated and should be replaced by *filterredir*
-* 10.0.0: *importlib_metadata* of :mod:`backports` is deprecated
* 9.6.0: :meth:`BaseSite.languages()<pywikibot.site._basesite.BaseSite.languages>` will be removed in favour of
:attr:`BaseSite.codes<pywikibot.site._basesite.BaseSite.codes>`
* 9.5.0: :meth:`DataSite.getPropertyType()<pywikibot.site._datasite.DataSite.getPropertyType>` will be removed
diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index a16161c..d93b8a0 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -3,8 +3,6 @@
.. deprecated:: 9.0
The *nullcontext* context manager; use ``contextlib.nullcontext``
instead. The *SimpleQueue* queue; use ``queue.SimpleQueue`` instead.
-.. deprecated:: 10.0
- The *importlib_metadata* lib. Import ``importlib.metadata`` instead.
"""
#
# (C) Pywikibot team, 2014-2024
@@ -218,6 +216,3 @@
wrapper.add_deprecated_attr('SimpleQueue',
replacement_name='queue.SimpleQueue',
since='9.0.0')
-wrapper.add_deprecated_attr('importlib_metadata',
- replacement_name='importlib.metadata',
- since='10.0.0')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100501?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: I00fcd83eec2e46cc9a62fdb0049c76f7a315f733
Gerrit-Change-Number: 1100501
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100774?usp=email )
Change subject: cleanup: boolean *watch* parameter of BasePage.save is desupported
......................................................................
cleanup: boolean *watch* parameter of BasePage.save is desupported
Bug: T378898
Change-Id: I872e7c4720585d1be8ecaeb7f1364a08c53379de
---
M ROADMAP.rst
M pywikibot/page/_basepage.py
2 files changed, 13 insertions(+), 10 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index bea3c86..b8fc450 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -11,6 +11,7 @@
**Breaking changes and code cleanups**
+* A boolean *watch* parameter in :meth:`page.BasePage.save` is desupported
* ``XMLDumpOldPageGenerator`` was removed in favour of a ``content`` parameter of
:func:`pagegenerators.XMLDumpPageGenerator` (:phab:`T306134`)
* :meth:`pywikibot.User.is_blocked` method was renamed from ``isBlocked`` for consistency
@@ -105,6 +106,5 @@
arguments must be used instead.
* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.logging.exception>` function was renamed to ``exc_info``
* 7.1.0: Unused ``get_redirect`` parameter of :meth:`Page.getOldVersion()<page.BasePage.getOldVersion>` will be removed
-* 7.0.0: A boolean watch parameter in Page.save() is deprecated and will be desupported
* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers()
DataSite methods will be removed
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 28ad6db..8210f17 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -18,7 +18,7 @@
import pywikibot
from pywikibot import Timestamp, config, date, i18n, textlib, tools
-from pywikibot.backports import Generator, Iterable
+from pywikibot.backports import Generator, Iterable, NoneType
from pywikibot.cosmetic_changes import CANCEL, CosmeticChangesToolkit
from pywikibot.exceptions import (
Error,
@@ -1293,6 +1293,8 @@
edits cannot be marked as bot edits if the bot account has no
``bot`` right. Therefore a ``None`` argument for *bot*
parameter was dropped.
+ .. versionchanged:: 10.0
+ boolean *watch* parameter is desupported
.. hint:: Setting up :manpage:`OAuth` or :manpage:`BotPassword
<BotPasswords>` login, you have to grant
@@ -1333,21 +1335,22 @@
:param quiet: enable/disable successful save operation message;
defaults to False. In asynchronous mode, if True, it is up
to the calling bot to manage the output e.g. via callback.
+ :raises TypeError: watch parameter must be a string literal or
+ None
+ :raises OtherPageSaveError: Editing restricted by a template.
"""
if not summary:
summary = config.default_edit_summary
- if isinstance(watch, bool): # pragma: no cover
- issue_deprecation_warning(
- 'boolean watch parameter',
- '"watch", "unwatch", "preferences" or "nochange" value',
- since='7.0.0')
- watch = ('unwatch', 'watch')[watch]
-
+ if not isinstance(watch, (str, NoneType)):
+ raise TypeError(
+ f'watch parameter must be a string literal, not {watch}')
if not force and not self.botMayEdit():
raise OtherPageSaveError(
self, 'Editing restricted by {{bots}}, {{nobots}} '
- "or site's equivalent of {{in use}} template")
+ "or site's equivalent of {{in use}} template"
+ )
+
self._save(summary=summary, watch=watch, minor=minor, bot=bot,
asynchronous=asynchronous, callback=callback,
cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100774?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: I872e7c4720585d1be8ecaeb7f1364a08c53379de
Gerrit-Change-Number: 1100774
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100752?usp=email )
Change subject: doc: move flow support deprecation to pending removal in Pywikibot 10
......................................................................
doc: move flow support deprecation to pending removal in Pywikibot 10
Bug: T381551
Change-Id: I9211796e2f2d7af210a5d5bd571870bf8e51eb42
---
M ROADMAP.rst
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index bea3c86..691f39f 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -38,7 +38,6 @@
:attr:`BaseSite.codes<pywikibot.site._basesite.BaseSite.codes>`
* 9.5.0: :meth:`DataSite.getPropertyType()<pywikibot.site._datasite.DataSite.getPropertyType>` will be removed
in favour of :meth:`DataSite.get_property_type()<pywikibot.site._datasite.DataSite.get_property_type>`
-* 9.4.0: :mod:`flow` support is deprecated and will be removed (:phab:`T371180`)
* 9.3.0: :meth:`page.BasePage.userName` and :meth:`page.BasePage.isIpEdit` are deprecated in favour of
``user`` or ``anon`` attributes of :attr:`page.BasePage.latest_revision` property
* 9.2.0: Imports of :mod:`logging` functions from :mod:`bot` module is deprecated and will be desupported
@@ -97,6 +96,7 @@
Pending removal in Pywikibot 10
-------------------------------
+* 9.4.0: :mod:`flow` support is deprecated and will be removed (:phab:`T371180`)
* 7.5.0: :mod:`textlib`.tzoneFixedOffset class will be removed in favour of :class:`time.TZoneFixedOffset`
* 7.4.0: ``FilePage.usingPages()`` was renamed to :meth:`using_pages()<pywikibot.FilePage.using_pages>`
* 7.3.0: ``linktrail`` method of :class:`family.Family` is deprecated; use :meth:`APISite.linktrail()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100752?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: I9211796e2f2d7af210a5d5bd571870bf8e51eb42
Gerrit-Change-Number: 1100752
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100480?usp=email )
Change subject: cleanup: remove User.isBlocked()
......................................................................
cleanup: remove User.isBlocked()
Bug: T378898
Change-Id: I540a2d915261f08815d474b213818ade99679758
---
M ROADMAP.rst
M pywikibot/page/_user.py
2 files changed, 2 insertions(+), 13 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 724ba87..26374f1 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -11,6 +11,7 @@
**Breaking changes and code cleanups**
+* :meth:`pywikibot.User.is_blocked` method was renamed from ``isBlocked`` for consistency
* Values of :meth:`APISite.allpages()<pywikibot.site._generators.GeneratorsMixin.allpages>`
parameter filterredir must be True, False or None
* :mod:`tools.threading` classes no longer can be imported from :mod:`tools`
@@ -104,7 +105,6 @@
* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` parameter of
:func:`XMLDumpPageGenerator<pagegenerators.XMLDumpPageGenerator>` (:phab:`T306134`)
* 7.1.0: Unused ``get_redirect`` parameter of :meth:`Page.getOldVersion()<page.BasePage.getOldVersion>` will be removed
-* 7.0.0: User.isBlocked() method is renamed to is_blocked for consistency
* 7.0.0: A boolean watch parameter in Page.save() is deprecated and will be desupported
* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers()
DataSite methods will be removed
diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 49e76e8..9f20a8d 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -18,7 +18,7 @@
from pywikibot.page._links import Link
from pywikibot.page._page import Page
from pywikibot.page._revision import Revision
-from pywikibot.tools import deprecated, is_ip_address, is_ip_network
+from pywikibot.tools import is_ip_address, is_ip_network
__all__ = ('User', )
@@ -134,17 +134,6 @@
"""
return 'blockedby' in self.getprops(force)
- @deprecated('is_blocked', since='7.0.0')
- def isBlocked(self, force: bool = False) -> bool: # noqa: N802
- """Determine whether the user is currently blocked.
-
- .. deprecated:: 7.0
- use :meth:`is_blocked` instead
-
- :param force: if True, forces reloading the data from API
- """
- return self.is_blocked(force)
-
def is_locked(self, force: bool = False) -> bool:
"""Determine whether the user is currently locked globally.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100480?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: I540a2d915261f08815d474b213818ade99679758
Gerrit-Change-Number: 1100480
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100478?usp=email )
Change subject: cleanup: remove issue_deprecation_warning for APISite.allpages()
......................................................................
cleanup: remove issue_deprecation_warning for APISite.allpages()
- remove issue_deprecation_warning for filterredir parameter of
APISite.allpages() and raise a TypeError if the parameter is invalid.
- deprecate includeredirects parameter of
pagegenerators.AllpagesPageGenerator and
pagegenerators.PrefixingPageGenerator; filterredir parameter should
be used instead.
- update tests
Change-Id: I5131bcbd89deed6545e4f886a66d587e228726b0
---
M ROADMAP.rst
M pywikibot/pagegenerators/_generators.py
M pywikibot/site/_generators.py
M tests/site_tests.py
4 files changed, 110 insertions(+), 84 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index b7fc4c2..724ba87 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -11,6 +11,8 @@
**Breaking changes and code cleanups**
+* Values of :meth:`APISite.allpages()<pywikibot.site._generators.GeneratorsMixin.allpages>`
+ parameter filterredir must be True, False or None
* :mod:`tools.threading` classes no longer can be imported from :mod:`tools`
* :mod:`tools.itertools` datatypes no longer can be imported from :mod:`tools`
* :mod:`tools.collections` datatypes no longer can be imported from :mod:`tools`
@@ -26,6 +28,8 @@
Current Deprecations
====================
+* 10.0.0: *includeredirects* parameter of :func:`pagegenerators.AllpagesPageGenerator` and
+ :func:`pagegenerators.PrefixingPageGenerator` is deprecated and should be replaced by *filterredir*
* 10.0.0: *importlib_metadata* of :mod:`backports` is deprecated
* 9.6.0: :meth:`BaseSite.languages()<pywikibot.site._basesite.BaseSite.languages>` will be removed in favour of
:attr:`BaseSite.codes<pywikibot.site._basesite.BaseSite.codes>`
@@ -104,4 +108,3 @@
* 7.0.0: A boolean watch parameter in Page.save() is deprecated and will be desupported
* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers()
DataSite methods will be removed
-* 7.0.0: Values of APISite.allpages() parameter filterredir other than True, False and None are deprecated
diff --git a/pywikibot/pagegenerators/_generators.py b/pywikibot/pagegenerators/_generators.py
index ffe6752..a536928 100644
--- a/pywikibot/pagegenerators/_generators.py
+++ b/pywikibot/pagegenerators/_generators.py
@@ -11,6 +11,7 @@
import io
import re
import sys
+import typing
from collections import abc
from functools import partial
from http import HTTPStatus
@@ -32,7 +33,7 @@
from pywikibot.comms import http
from pywikibot.exceptions import APIError, ServerError
from pywikibot.site import Namespace
-from pywikibot.tools import deprecated
+from pywikibot.tools import deprecated, issue_deprecation_warning
from pywikibot.tools.collections import GeneratorWrapper
from pywikibot.tools.itertools import filter_unique
@@ -42,7 +43,6 @@
from pywikibot.site._namespace import SingleNamespaceType
from pywikibot.time import Timestamp
-
# This is the function that will be used to de-duplicate page iterators.
_filter_unique_pages = partial(
filter_unique, key=lambda page: '{}:{}:{}'.format(*page._cmpkey()))
@@ -51,51 +51,93 @@
def AllpagesPageGenerator(
start: str = '!',
namespace: SingleNamespaceType = 0,
- includeredirects: str | bool = True,
+ includeredirects: typing.Literal['only'] | bool = True,
site: BaseSite | None = None,
- total: int | None = None, content: bool = False
+ total: int | None = None,
+ content: bool = False,
+ *,
+ filterredir: bool | None = None,
) -> Iterable[pywikibot.page.Page]:
"""Iterate Page objects for all titles in a single namespace.
- If includeredirects is False, redirects are not included. If
- includeredirects equals the string 'only', only redirects are added.
+ .. deprecated:: 10.0
+ The *includeredirects* parameter; use *filterredir* instead.
+ .. seealso:: :meth:`APISite.allpages()
+ <pywikibot.site._generators.GeneratorsMixin.allpages>`
- :param total: Maximum number of pages to retrieve in total
- :param content: If True, load current version of each page (default False)
+ :param start: if provided, only generate pages >= this title
+ lexically
+ :param namespace: Namespace to retrieve pages from
+ :param includeredirects: If False, redirects are not included. If
+ equals the string 'only', only redirects are added. Otherwise
+ redirects will be included. This parameter is deprecated; use
+ *filterredir* instead.
:param site: Site for generator results.
+ :param total: Maximum number of pages to retrieve in total
+ :param content: If True, load current version of each page (default
+ False)
+ :param filterredir: if True, only yield redirects; if False (and
+ not None), only yield non-redirects (default: yield both).
+ :return: a generator that yields Page objects
+ :raises ValueError: *filterredir* as well as *includeredirects*
+ parameters were given. Use *filterredir* only.
"""
if site is None:
site = pywikibot.Site()
- filterredir: bool | None = None
- if not includeredirects:
- filterredir = False
- elif includeredirects == 'only':
- filterredir = True
+ if filterredir is not None and includeredirects is not True:
+ raise ValueError(
+ f'filterredir parameter ({filterredir}) is used together with '
+ f'outdated includeredirects parameter ({includeredirects}).'
+ )
+
+ # backward compatibility
+ if includeredirects is not True:
+ if not includeredirects:
+ filterredir = False
+ elif includeredirects == 'only':
+ filterredir = True
+
+ issue_deprecation_warning(
+ 'includeredirects parameter ({includeredirects})',
+ f'filterredir={filterredir}',
+ since='10.0.0'
+ )
return site.allpages(start=start, namespace=namespace,
filterredir=filterredir, total=total, content=content)
-def PrefixingPageGenerator(prefix: str,
- namespace: SingleNamespaceType | None = None,
- includeredirects: bool | str | None = True,
- site: BaseSite | None = None,
- total: int | None = None,
- content: bool = False
- ) -> Iterable[pywikibot.page.Page]:
+def PrefixingPageGenerator(
+ prefix: str,
+ namespace: SingleNamespaceType | None = None,
+ includeredirects: typing.Literal['only'] | bool = True,
+ site: BaseSite | None = None,
+ total: int | None = None,
+ content: bool = False,
+ *,
+ filterredir: bool | None = None,
+) -> Iterable[pywikibot.page.Page]:
"""Prefixed Page generator.
+ .. deprecated:: 10.0
+ The *includeredirects* parameter; use *filterredir* instead.
+
:param prefix: The prefix of the pages.
:param namespace: Namespace to retrieve pages from
- :param includeredirects: If includeredirects is None, False or an empty
- string, redirects will not be found. If includeredirects equals the
- string 'only', only redirects will be found. Otherwise redirects will
- be included.
+ :param includeredirects: If False, redirects are not included. If
+ equals the string 'only', only redirects are added. Otherwise
+ redirects will be included. This parameter is deprecated; use
+ *filterredir* instead.
:param site: Site for generator results.
:param total: Maximum number of pages to retrieve in total
- :param content: If True, load current version of each page (default False)
+ :param content: If True, load current version of each page (default
+ False)
+ :param filterredir: if True, only yield redirects; if False (and
+ not None), only yield non-redirects (default: yield both).
:return: a generator that yields Page objects
+ :raises ValueError: *filterredir* as well as *includeredirects*
+ parameters were given. Use *filterredir* only.
"""
if site is None:
site = pywikibot.Site()
@@ -105,11 +147,24 @@
namespace = prefixlink.namespace
title = prefixlink.title
- filterredir: bool | None = None
- if not includeredirects:
- filterredir = False
- elif includeredirects == 'only':
- filterredir = True
+ if filterredir is not None and includeredirects is not True:
+ raise ValueError(
+ f'filterredir parameter ({filterredir}) is used together with '
+ f'outdated includeredirects parameter ({includeredirects}).'
+ )
+
+ # backward compatibility
+ if includeredirects is not True:
+ if not includeredirects:
+ filterredir = False
+ elif includeredirects == 'only':
+ filterredir = True
+
+ issue_deprecation_warning(
+ 'includeredirects parameter ({includeredirects})',
+ f'filterredir={filterredir}',
+ since='10.0.0'
+ )
return site.allpages(prefix=title, namespace=namespace,
filterredir=filterredir, total=total, content=content)
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 145430f..b4ff377 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -25,11 +25,7 @@
)
from pywikibot.site._decorators import need_right
from pywikibot.site._namespace import NamespaceArgType
-from pywikibot.tools import (
- deprecate_arg,
- is_ip_address,
- issue_deprecation_warning,
-)
+from pywikibot.tools import deprecate_arg, is_ip_address
from pywikibot.tools.itertools import filter_unique
@@ -950,40 +946,32 @@
:param start: Start at this title (page need not exist).
:param prefix: Only yield pages starting with this string.
- :param namespace: Iterate pages from this (single) namespace
- :param filterredir: if True, only yield redirects; if False (and not
- None), only yield non-redirects (default: yield both)
- :param filterlanglinks: if True, only yield pages with language links;
- if False (and not None), only yield pages without language links
- (default: yield both)
+ :param namespace: Iterate pages from this (single) namespace.
+ :param filterredir: if True, only yield redirects; if False (and
+ not None), only yield non-redirects (default: yield both).
+ :param filterlanglinks: if True, only yield pages with language
+ links; if False (and not None), only yield pages without
+ language links (default: yield both).
:param minsize: if present, only yield pages at least this many
- bytes in size
- :param maxsize: if present, only yield pages at most this many bytes
- in size
- :param protect_type: only yield pages that have a protection of the
- specified type
- :param protect_level: only yield pages that have protection at this
- level; can only be used if protect_type is specified
+ bytes in size.
+ :param maxsize: if present, only yield pages at most this many
+ bytes in size.
+ :param protect_type: only yield pages that have a protection of
+ the specified type.
+ :param protect_level: only yield pages that have protection at
+ this level; can only be used if protect_type is specified.
:param reverse: if True, iterate in reverse Unicode lexigraphic
- order (default: iterate in forward order)
- :param content: if True, load the current content of each iterated page
- (default False)
+ order (default: iterate in forward order).
+ :param content: if True, load the current content of each
+ iterated page (default False).
:raises KeyError: the namespace identifier was not resolved
:raises TypeError: the namespace identifier has an inappropriate
- type such as bool, or an iterable with more than one namespace
+ type such as bool, or an iterable with more than one
+ namespace or *filterredir* parameter has an invalid type.
"""
- # backward compatibility test
if filterredir not in (True, False, None):
- old = filterredir
- if not filterredir:
- filterredir = False
- elif filterredir == 'only':
- filterredir = True
- else:
- filterredir = None
- issue_deprecation_warning(
- f'The value "{old}" for "filterredir"',
- f'"{filterredir}"', since='7.0.0')
+ raise TypeError('filterredir parameter must be True, False or '
+ f'None, not {type(filterredir)}')
apgen = self._generator(api.PageGenerator, type_arg='allpages',
namespaces=namespace,
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 90301bf..e95633e 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -36,26 +36,6 @@
from tests.basepage import BasePageLoadRevisionsCachingTestBase
-class TestSiteObjectDeprecatedFunctions(DefaultSiteTestCase,
- DeprecationTestCase):
-
- """Test cases for Site deprecated methods on a live wiki."""
-
- cached = True
-
- def test_allpages_filterredir_true(self):
- """Test that filterredir set to 'only' is deprecated to True."""
- for page in self.site.allpages(filterredir='only', total=1):
- self.assertTrue(page.isRedirectPage())
- self.assertOneDeprecation()
-
- def test_allpages_filterredir_talse(self):
- """Test if filterredir's bool is False it's deprecated to False."""
- for page in self.site.allpages(filterredir='', total=1):
- self.assertFalse(page.isRedirectPage())
- self.assertOneDeprecation()
-
-
class TestSiteObject(DefaultSiteTestCase):
"""Test cases for Site methods."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100478?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: I5131bcbd89deed6545e4f886a66d587e228726b0
Gerrit-Change-Number: 1100478
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100493?usp=email )
Change subject: cleanup: Desupport MW < 1.31
......................................................................
cleanup: Desupport MW < 1.31
- update documentation
- update SparqlQuery
- update sparql_endpoint and concept_base_uri of DataSite
Bug: T378984
Change-Id: Ic07573ccb474eb8dabcfb4122043b65488cb1df0
---
M README.rst
M docs/index.rst
M pywikibot/data/sparql.py
M pywikibot/site/_datasite.py
4 files changed, 17 insertions(+), 23 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/README.rst b/README.rst
index 5105d06..b63a5d7 100644
--- a/README.rst
+++ b/README.rst
@@ -35,7 +35,7 @@
The Pywikibot framework is a Python library that interfaces with the
`MediaWiki API <https://www.mediawiki.org/wiki/API:Main_page>`_
-version 1.27 or higher.
+version 1.31 or higher.
Also included are various general function scripts that can be adapted for
different tasks.
diff --git a/docs/index.rst b/docs/index.rst
index 228bc7b..8ee6069 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -12,7 +12,7 @@
The project started in 2003 and is currently on core version |version|.
It features full API usage and is up-to-date with new MediaWiki features and
a Pythonic package layout. But it also works with older installations of
-MediaWiki 1.27 or higher. For older MediaWiki versions you have to use older
+MediaWiki 1.31 or higher. For older MediaWiki versions you have to use older
Pywikibot releases; refer :manpage:`Compatibility`.
Pywikibot supports Microsoft Windows, macOS and Linux when used with a
diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py
index d217e8b..622c012 100644
--- a/pywikibot/data/sparql.py
+++ b/pywikibot/data/sparql.py
@@ -46,31 +46,27 @@
"""Create endpoint.
:param endpoint: SPARQL endpoint URL
- :param entity_url: URL prefix for any entities returned in a query.
- :param repo: The Wikibase site which we want to run queries on. If
- provided this overrides any value in endpoint and entity_url.
- Defaults to Wikidata.
+ :param entity_url: URL prefix for any entities returned in a
+ query.
+ :param repo: The Wikibase site which we want to run queries on.
+ If provided this overrides any value in endpoint and
+ entity_url. Defaults to Wikidata.
:type repo: pywikibot.site.DataSite
- :param max_retries: (optional) Maximum number of times to retry after
- errors, defaults to config.max_retries.
- :param retry_wait: (optional) Minimum time in seconds to wait after an
- error, defaults to config.retry_wait seconds (doubles each retry
- until config.retry_max is reached).
+ :param max_retries: (optional) Maximum number of times to retry
+ after errors, defaults to config.max_retries.
+ :param retry_wait: (optional) Minimum time in seconds to wait
+ after an error, defaults to config.retry_wait seconds
+ (doubles each retry until config.retry_max is reached).
+ :raises Error: The site does not provide a sparql endpoint or if
+ initialised with an endpoint the entity_url must be provided.
"""
# default to Wikidata
if not repo and not endpoint:
repo = Site('wikidata')
if repo:
- try:
- self.endpoint = repo.sparql_endpoint
- self.entity_url = repo.concept_base_uri
- except NotImplementedError:
- raise NotImplementedError(
- 'Wiki version must be 1.28-wmf.23 or newer to '
- 'automatically extract the sparql endpoint. '
- 'Please provide the endpoint and entity_url '
- 'parameters instead of a repo.')
+ self.endpoint = repo.sparql_endpoint
+ self.entity_url = repo.concept_base_uri
if not self.endpoint:
raise Error(
f'The site {repo} does not provide a sparql endpoint.')
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index 8568485..5d61f1b 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -24,7 +24,7 @@
NoWikibaseEntityError,
)
from pywikibot.site._apisite import APISite
-from pywikibot.site._decorators import need_extension, need_right, need_version
+from pywikibot.site._decorators import need_extension, need_right
from pywikibot.tools import deprecated, merge_unique_dicts, remove_last_args
@@ -138,7 +138,6 @@
raise NoWikibaseEntityError(entity)
@property
- @need_version('1.28-wmf.3')
def sparql_endpoint(self):
"""Return the sparql endpoint url, if any has been set.
@@ -148,7 +147,6 @@
return self.siteinfo['general'].get('wikibase-sparql')
@property
- @need_version('1.28-wmf.23')
def concept_base_uri(self):
"""Return the base uri for concepts/entities.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1100493?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: Ic07573ccb474eb8dabcfb4122043b65488cb1df0
Gerrit-Change-Number: 1100493
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot