jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1201556?usp=email )
Change subject: cleanup: remove deprecated code parts and update ROADMAP.rst
......................................................................
cleanup: remove deprecated code parts and update ROADMAP.rst
- remove Timestamp.clone()
- remove itertools.itergroup
- keep itertools.itergroup within module documentation with versionremoved
directive
Bug: T401802
Change-Id: Ifde3482e07dead756614ea0686f638e8c53d8568
---
M ROADMAP.rst
M docs/api_ref/tools/tools.itertools.rst
M pywikibot/time.py
M pywikibot/tools/itertools.py
4 files changed, 17 insertions(+), 52 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index b03f62c..76a3375 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -12,6 +12,9 @@
**Code cleanups**
+* The ``Timestamp.clone()`` method was removed in favour of the
``Timestamp.replace()`` method
+* The ``tools.itertools.itergroup`` function was removed in favour of the
+ :func:`backports.batched` or
:pylib:`itertools.batched<itertools#itertools.batched>` function.
* The ``get_login_token()`` method of :class:`login.ClientLoginManager`
was removed and can be replaces by
``login.LoginManager.site.tokens['login']``
* The :meth:`family.Family.maximum_GET_length` method was removed in favour of
the
@@ -62,12 +65,8 @@
:attr:`data.api.QueryGenerator.modules`
* 8.4.0: The *dropdelay* and *releasepid* attributes of the
:class:`throttle.Throttle` class will be
removed in favour of the *expiry* class attribute
-* 8.2.0: The :func:`tools.itertools.itergroup` function will be removed in
favour of the
- :func:`backports.batched` function
* 8.1.0: The inheritance of the :exc:`exceptions.NoSiteLinkError` exception
from
:exc:`exceptions.NoPageError` will be removed
-* 8.0.0: The :meth:`Timestamp.clone()<pywikibot.time.Timestamp.clone>` method
is deprecated in
- favour of the ``Timestamp.replace()`` method
* 8.0.0: The ``addOnly`` parameter in the :func:`textlib.replaceLanguageLinks`
and
:func:`textlib.replaceCategoryLinks` functions is deprecated in favour of
``add_only``
* 8.0.0: The regex attributes ``ptimeR``, ``ptimeznR``, ``pyearR``,
``pmonthR``, and ``pdayR`` of
diff --git a/docs/api_ref/tools/tools.itertools.rst
b/docs/api_ref/tools/tools.itertools.rst
index f865ffb..9aa7746 100644
--- a/docs/api_ref/tools/tools.itertools.rst
+++ b/docs/api_ref/tools/tools.itertools.rst
@@ -4,3 +4,15 @@
.. automodule:: tools.itertools
:synopsis: Iterator functions
+
+.. currentmodule:: tools.itertools
+.. function:: itergroup(iterable, size: int, strict: bool = False) ->
Generator[list[Any]]
+
+ Make an iterator that returns lists of (up to) *size* items from *iterable*.
+
+ .. versionadded:: 7.6
+ The *strict* parameter.
+ .. deprecated:: 8.2
+ Use :func:`backports.batched` instead.
+ .. versionremoved:: 11.0
+ This function was removed; use
:pylib:`itertools.batched<itertools#itertools.batched>` instead.
diff --git a/pywikibot/time.py b/pywikibot/time.py
index 2e6832b..73a4123 100644
--- a/pywikibot/time.py
+++ b/pywikibot/time.py
@@ -17,7 +17,7 @@
from contextlib import suppress
import pywikibot
-from pywikibot.tools import PYTHON_VERSION, classproperty, deprecated
+from pywikibot.tools import PYTHON_VERSION, classproperty
__all__ = (
@@ -218,15 +218,6 @@
raise ValueError(f'time data {timestr!r} does not match any format.')
- @deprecated('replace method', since='8.0.0') # type: ignore[misc]
- def clone(self) -> Timestamp:
- """Clone this instance.
-
- .. deprecated:: 8.0
- Use :meth:`replace` method instead.
- """
- return self.replace()
-
@classproperty
def ISO8601Format(cls) -> str: # noqa: N802
"""ISO8601 format string class property for compatibility purpose."""
diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py
index 2596977..b06f6bf 100644
--- a/pywikibot/tools/itertools.py
+++ b/pywikibot/tools/itertools.py
@@ -17,55 +17,18 @@
from contextlib import suppress
from typing import Any
-from pywikibot.backports import batched
from pywikibot.logging import debug
-from pywikibot.tools import deprecated
__all__ = (
'filter_unique',
'intersect_generators',
'islice_with_ellipsis',
- 'itergroup',
'roundrobin_generators',
'union_generators',
)
-@deprecated('backports.batched()', since='8.2.0')
-def itergroup(iterable,
- size: int,
- strict: bool = False) -> Generator[list[Any]]:
- """Make an iterator that returns lists of (up to) size items from iterable.
-
- Example:
-
- >>> i = itergroup(range(25), 10)
- >>> print(next(i))
- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- >>> print(next(i))
- [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
- >>> print(next(i))
- [20, 21, 22, 23, 24]
- >>> print(next(i))
- Traceback (most recent call last):
- ...
- StopIteration
-
- .. versionadded:: 7.6
- The *strict* parameter.
- .. deprecated:: 8.2
- Use :func:`backports.batched` instead.
-
- :param size: How many items of the iterable to get in one chunk
- :param strict: If True, raise a ValueError if length of iterable is
- not divisible by `size`.
- :raises ValueError: iterable is not divisible by size
- """
- for group in batched(iterable, size, strict=strict):
- yield list(group)
-
-
def islice_with_ellipsis(iterable, *args, marker: str = '…'):
"""Generator which yields the first n elements of the iterable.
@@ -101,7 +64,7 @@
duplicates. The input iterables must already be sorted according to
the same *key* and direction. For descending direction, *reverse*
must be ``True``. The generator will yield each element only once,
- even if it appears in multiple iterables. This behaves similarly to:
+ even if it appears in multiple iterables. This behaves similarly to::
sorted(set(itertools.chain(*iterables)), key=key, reverse=reverse)
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1201556?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: Ifde3482e07dead756614ea0686f638e8c53d8568
Gerrit-Change-Number: 1201556
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]