From 87ca57abc002e902a58485bd41ec6e9424ced913 Mon Sep 17 00:00:00 2001 From: Lushiyao5 <321342421+Lushiyao5@users.noreply.github.com> Date: Sat, 28 Nov 2026 21:32:42 -0700 Subject: [PATCH] [tqdm] Infer the result type of tmap Assisted-by: OpenAI Codex --- stubs/tqdm/tqdm/contrib/__init__.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stubs/tqdm/tqdm/contrib/__init__.pyi b/stubs/tqdm/tqdm/contrib/__init__.pyi index f190309890d9..1a8d7f0e8290 100644 --- a/stubs/tqdm/tqdm/contrib/__init__.pyi +++ b/stubs/tqdm/tqdm/contrib/__init__.pyi @@ -1,10 +1,13 @@ from _typeshed import Incomplete from collections.abc import Callable, Generator +from typing import TypeVar from ..utils import ObjectWrapper __all__ = ["tenumerate", "tzip", "tmap"] +_T = TypeVar("_T") + class DummyTqdmFile(ObjectWrapper): def __init__(self, wrapped) -> None: ... def write(self, x, nolock: bool = False) -> None: ... @@ -12,4 +15,4 @@ class DummyTqdmFile(ObjectWrapper): def tenumerate(iterable, start: int = 0, total=None, tqdm_class: type[Incomplete] = ..., **tqdm_kwargs): ... def tzip(iter1, *iter2plus, **tqdm_kwargs) -> Generator[Incomplete]: ... -def tmap(function: Callable[..., Incomplete], *sequences, **tqdm_kwargs) -> Generator[Incomplete]: ... +def tmap(function: Callable[..., _T], *sequences, **tqdm_kwargs) -> Generator[_T]: ...