Skip to content

Commit d4d2cd5

Browse files
committed
Bump tqdm to 4.70.*
1 parent b0aeac2 commit d4d2cd5

2 files changed

Lines changed: 91 additions & 17 deletions

File tree

stubs/tqdm/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "4.69.*"
1+
version = "4.70.*"
22
upstream-repository = "https://github.com/tqdm/tqdm"
33
optional-dependencies = ["types-requests", "types-tensorflow"]
44

stubs/tqdm/tqdm/contrib/concurrent.pyi

Lines changed: 90 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
from _typeshed import SupportsWrite
2-
from collections.abc import Callable, Iterable, Mapping
1+
from _typeshed import SupportsWrite, Incomplete
2+
from contextlib import contextmanager
3+
from collections.abc import Callable, Iterable, Mapping, Generator
34
from typing import Any, TypedDict, TypeVar, overload, type_check_only
45
from typing_extensions import Unpack
6+
from multiprocessing.context import BaseContext
57

68
from ..std import tqdm
79

8-
__all__ = ["thread_map", "process_map"]
10+
__all__ = ["thread_map", "process_map", "interpreter_map"]
911

1012
_R = TypeVar("_R")
1113
_T1 = TypeVar("_T1")
@@ -20,7 +22,9 @@ class _TqdmKwargs(TypedDict, total=False):
2022
tqdm_class: type[tqdm[object]]
2123
max_workers: int | None
2224
chunksize: int
23-
lock_name: str
25+
# TODO: add when conditional fields in `TypedDict` will be supported:
26+
# if sys.version_info >= (3, 14):
27+
# buffersize: int | None
2428
# Standard tqdm parameters
2529
desc: str | None
2630
total: float | None
@@ -47,19 +51,36 @@ class _TqdmKwargs(TypedDict, total=False):
4751
colour: str | None
4852
delay: float | None
4953

54+
55+
@type_check_only
56+
class _TqdmProcessKwargs(_TqdmKwargs):
57+
mp_context: BaseContext | None
58+
max_tasks_per_child: int | None
59+
60+
61+
@type_check_only
62+
class _TqdmThreadKwargs(_TqdmKwargs):
63+
thread_name_prefix: str | None
64+
# Not techically for threading, but just a signature difference:
65+
lock_name: str
66+
67+
68+
@contextmanager
69+
def ensure_lock(tqdm_class: type[tqdm[object]], lock_name: str = "", lock: Incomplete | None = None) -> Generator[None]: ...
70+
5071
@overload
51-
def thread_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], **tqdm_kwargs: Unpack[_TqdmKwargs]) -> list[_R]: ...
72+
def thread_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], **tqdm_kwargs: Unpack[_TqdmThreadKwargs]) -> list[_R]: ...
5273
@overload
5374
def thread_map(
54-
fn: Callable[[_T1, _T2], _R], iter1: Iterable[_T1], iter2: Iterable[_T2], /, **tqdm_kwargs: Unpack[_TqdmKwargs]
75+
fn: Callable[[_T1, _T2], _R], iter1: Iterable[_T1], iter2: Iterable[_T2], /, **tqdm_kwargs: Unpack[_TqdmThreadKwargs]
5576
) -> list[_R]: ...
5677
@overload
5778
def thread_map(
5879
fn: Callable[[_T1, _T2, _T3], _R],
5980
iter1: Iterable[_T1],
6081
iter2: Iterable[_T2],
6182
iter3: Iterable[_T3],
62-
**tqdm_kwargs: Unpack[_TqdmKwargs],
83+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
6384
) -> list[_R]: ...
6485
@overload
6586
def thread_map(
@@ -68,7 +89,7 @@ def thread_map(
6889
iter2: Iterable[_T2],
6990
iter3: Iterable[_T3],
7091
iter4: Iterable[_T4],
71-
**tqdm_kwargs: Unpack[_TqdmKwargs],
92+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
7293
) -> list[_R]: ...
7394
@overload
7495
def thread_map(
@@ -78,7 +99,7 @@ def thread_map(
7899
iter3: Iterable[_T3],
79100
iter4: Iterable[_T4],
80101
iter5: Iterable[_T5],
81-
**tqdm_kwargs: Unpack[_TqdmKwargs],
102+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
82103
) -> list[_R]: ...
83104
@overload
84105
def thread_map(
@@ -90,22 +111,24 @@ def thread_map(
90111
iter5: Iterable[Any],
91112
iter6: Iterable[Any],
92113
*iterables: Iterable[Any],
93-
**tqdm_kwargs: Unpack[_TqdmKwargs],
114+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
94115
) -> list[_R]: ...
95116

96117
@overload
97-
def process_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], **tqdm_kwargs: Unpack[_TqdmKwargs]) -> list[_R]: ...
118+
def process_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], *, lock_name: str = "mp_lock", **tqdm_kwargs: Unpack[_TqdmProcessKwargs]) -> list[_R]: ...
98119
@overload
99120
def process_map(
100-
fn: Callable[[_T1, _T2], _R], iter1: Iterable[_T1], iter2: Iterable[_T2], **tqdm_kwargs: Unpack[_TqdmKwargs]
121+
fn: Callable[[_T1, _T2], _R], iter1: Iterable[_T1], iter2: Iterable[_T2], *, lock_name: str = "mp_lock", **tqdm_kwargs: Unpack[_TqdmProcessKwargs]
101122
) -> list[_R]: ...
102123
@overload
103124
def process_map(
104125
fn: Callable[[_T1, _T2, _T3], _R],
105126
iter1: Iterable[_T1],
106127
iter2: Iterable[_T2],
107128
iter3: Iterable[_T3],
108-
**tqdm_kwargs: Unpack[_TqdmKwargs],
129+
*,
130+
lock_name: str = "mp_lock",
131+
**tqdm_kwargs: Unpack[_TqdmProcessKwargs],
109132
) -> list[_R]: ...
110133
@overload
111134
def process_map(
@@ -114,7 +137,9 @@ def process_map(
114137
iter2: Iterable[_T2],
115138
iter3: Iterable[_T3],
116139
iter4: Iterable[_T4],
117-
**tqdm_kwargs: Unpack[_TqdmKwargs],
140+
*,
141+
lock_name: str = "mp_lock",
142+
**tqdm_kwargs: Unpack[_TqdmProcessKwargs],
118143
) -> list[_R]: ...
119144
@overload
120145
def process_map(
@@ -124,7 +149,9 @@ def process_map(
124149
iter3: Iterable[_T3],
125150
iter4: Iterable[_T4],
126151
iter5: Iterable[_T5],
127-
**tqdm_kwargs: Unpack[_TqdmKwargs],
152+
*,
153+
lock_name: str = "mp_lock",
154+
**tqdm_kwargs: Unpack[_TqdmProcessKwargs],
128155
) -> list[_R]: ...
129156
@overload
130157
def process_map(
@@ -136,5 +163,52 @@ def process_map(
136163
iter5: Iterable[Any],
137164
iter6: Iterable[Any],
138165
*iterables: Iterable[Any],
139-
**tqdm_kwargs: Unpack[_TqdmKwargs],
166+
lock_name: str = "mp_lock",
167+
**tqdm_kwargs: Unpack[_TqdmProcessKwargs],
168+
) -> list[_R]: ...
169+
170+
@overload
171+
def interpreter_map(fn: Callable[[_T1], _R], iter1: Iterable[_T1], **tqdm_kwargs: Unpack[_TqdmThreadKwargs]) -> list[_R]: ...
172+
@overload
173+
def interpreter_map(
174+
fn: Callable[[_T1, _T2], _R], iter1: Iterable[_T1], iter2: Iterable[_T2], /, **tqdm_kwargs: Unpack[_TqdmThreadKwargs]
175+
) -> list[_R]: ...
176+
@overload
177+
def interpreter_map(
178+
fn: Callable[[_T1, _T2, _T3], _R],
179+
iter1: Iterable[_T1],
180+
iter2: Iterable[_T2],
181+
iter3: Iterable[_T3],
182+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
183+
) -> list[_R]: ...
184+
@overload
185+
def interpreter_map(
186+
fn: Callable[[_T1, _T2, _T3, _T4], _R],
187+
iter1: Iterable[_T1],
188+
iter2: Iterable[_T2],
189+
iter3: Iterable[_T3],
190+
iter4: Iterable[_T4],
191+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
192+
) -> list[_R]: ...
193+
@overload
194+
def interpreter_map(
195+
fn: Callable[[_T1, _T2, _T3, _T4, _T5], _R],
196+
iter1: Iterable[_T1],
197+
iter2: Iterable[_T2],
198+
iter3: Iterable[_T3],
199+
iter4: Iterable[_T4],
200+
iter5: Iterable[_T5],
201+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
202+
) -> list[_R]: ...
203+
@overload
204+
def interpreter_map(
205+
fn: Callable[..., _R],
206+
iter1: Iterable[Any],
207+
iter2: Iterable[Any],
208+
iter3: Iterable[Any],
209+
iter4: Iterable[Any],
210+
iter5: Iterable[Any],
211+
iter6: Iterable[Any],
212+
*iterables: Iterable[Any],
213+
**tqdm_kwargs: Unpack[_TqdmThreadKwargs],
140214
) -> list[_R]: ...

0 commit comments

Comments
 (0)