jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/933908 )
Change subject: [doc] Update typing hints for batched and itergroup
......................................................................
[doc] Update typing hints for batched and itergroup
Change-Id: Iabeb1371520e5337fc35343eeb5e9c488ac04f74
---
M pywikibot/tools/itertools.py
M pywikibot/backports.py
2 files changed, 12 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 40a798f..c1a7d05 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -168,7 +168,7 @@
# gh-98363
if PYTHON_VERSION < (3, 12) or SPHINX_RUNNING:
- def batched(iterable, n: int) -> Generator[Any, None, None]:
+ def batched(iterable, n: int) -> Generator[tuple, None, None]:
"""Batch data from the *iterable* into tuples of length *n*.
.. note:: The last batch may be shorter than *n*.
diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py
index 4166aaf..f1c2fb1 100644
--- a/pywikibot/tools/itertools.py
+++ b/pywikibot/tools/itertools.py
@@ -14,7 +14,7 @@
from itertools import chain, zip_longest
from typing import Any
-from pywikibot.backports import batched, Generator
+from pywikibot.backports import batched, Generator, List
from pywikibot.logging import debug
from pywikibot.tools import deprecated, issue_deprecation_warning
@@ -31,7 +31,7 @@
@deprecated('backports.batched()', since='8.2.0')
def itergroup(iterable,
size: int,
- strict: bool = False) -> Generator[Any, None, None]:
+ strict: bool = False) -> Generator[List[Any], None, None]:
"""Make an iterator that returns lists of (up to) size items from
iterable.
Example:
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/933908
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iabeb1371520e5337fc35343eeb5e9c488ac04f74
Gerrit-Change-Number: 933908
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged