Skip to content

Commit ed0b3a4

Browse files
authored
tqdm: Improve a few __init__ methods (#8246)
1 parent e90ee8e commit ed0b3a4

File tree

4 files changed

+211
-12
lines changed

4 files changed

+211
-12
lines changed

stubs/tqdm/tqdm/contrib/discord.pyi

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from _typeshed import Incomplete
2-
from typing import Generic, TypeVar
1+
from _typeshed import Incomplete, SupportsWrite
2+
from collections.abc import Iterable, Mapping
3+
from typing import Generic, NoReturn, TypeVar, overload
34

45
from ..auto import tqdm as tqdm_auto
56
from .utils_worker import MonoWorker
@@ -14,7 +15,68 @@ _T = TypeVar("_T")
1415

1516
class tqdm_discord(Generic[_T], tqdm_auto[_T]):
1617
dio: Incomplete
17-
def __init__(self, *args, **kwargs) -> None: ...
18+
@overload
19+
def __init__(
20+
self,
21+
iterable: Iterable[_T],
22+
desc: str | None = ...,
23+
total: float | None = ...,
24+
leave: bool = ...,
25+
file: SupportsWrite[str] | None = ...,
26+
ncols: int | None = ...,
27+
mininterval: float = ...,
28+
maxinterval: float = ...,
29+
miniters: float | None = ...,
30+
ascii: bool | str | None = ...,
31+
disable: bool = ...,
32+
unit: str = ...,
33+
unit_scale: bool | float = ...,
34+
dynamic_ncols: bool = ...,
35+
smoothing: float = ...,
36+
bar_format: str | None = ...,
37+
initial: float = ...,
38+
position: int | None = ...,
39+
postfix: Mapping[str, object] | str | None = ...,
40+
unit_divisor: float = ...,
41+
write_bytes: bool | None = ...,
42+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
43+
nrows: int | None = ...,
44+
colour: str | None = ...,
45+
delay: float | None = ...,
46+
gui: bool = ...,
47+
**kwargs,
48+
) -> None: ...
49+
@overload
50+
def __init__(
51+
self: tqdm_discord[NoReturn],
52+
iterable: None = ...,
53+
desc: str | None = ...,
54+
total: float | None = ...,
55+
leave: bool = ...,
56+
file: SupportsWrite[str] | None = ...,
57+
ncols: int | None = ...,
58+
mininterval: float = ...,
59+
maxinterval: float = ...,
60+
miniters: float | None = ...,
61+
ascii: bool | str | None = ...,
62+
disable: bool = ...,
63+
unit: str = ...,
64+
unit_scale: bool | float = ...,
65+
dynamic_ncols: bool = ...,
66+
smoothing: float = ...,
67+
bar_format: str | None = ...,
68+
initial: float = ...,
69+
position: int | None = ...,
70+
postfix: Mapping[str, object] | str | None = ...,
71+
unit_divisor: float = ...,
72+
write_bytes: bool | None = ...,
73+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
74+
nrows: int | None = ...,
75+
colour: str | None = ...,
76+
delay: float | None = ...,
77+
gui: bool = ...,
78+
**kwargs,
79+
) -> None: ...
1880
def display(
1981
self,
2082
msg: str | None = ...,

stubs/tqdm/tqdm/contrib/slack.pyi

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from _typeshed import Incomplete
2-
from typing import Generic, TypeVar
1+
from _typeshed import Incomplete, SupportsWrite
2+
from collections.abc import Iterable, Mapping
3+
from typing import Generic, NoReturn, TypeVar, overload
34

45
from ..auto import tqdm as tqdm_auto
56
from .utils_worker import MonoWorker
@@ -15,7 +16,72 @@ _T = TypeVar("_T")
1516

1617
class tqdm_slack(Generic[_T], tqdm_auto[_T]):
1718
sio: Incomplete
18-
def __init__(self, *args, **kwargs) -> None: ...
19+
@overload
20+
def __init__(
21+
self,
22+
iterable: Iterable[_T],
23+
desc: str | None = ...,
24+
total: float | None = ...,
25+
leave: bool = ...,
26+
file: SupportsWrite[str] | None = ...,
27+
ncols: int | None = ...,
28+
mininterval: float = ...,
29+
maxinterval: float = ...,
30+
miniters: float | None = ...,
31+
ascii: bool | str | None = ...,
32+
disable: bool = ...,
33+
unit: str = ...,
34+
unit_scale: bool | float = ...,
35+
dynamic_ncols: bool = ...,
36+
smoothing: float = ...,
37+
bar_format: str | None = ...,
38+
initial: float = ...,
39+
position: int | None = ...,
40+
postfix: Mapping[str, object] | str | None = ...,
41+
unit_divisor: float = ...,
42+
write_bytes: bool | None = ...,
43+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
44+
nrows: int | None = ...,
45+
colour: str | None = ...,
46+
delay: float | None = ...,
47+
gui: bool = ...,
48+
token: str = ...,
49+
channel: int = ...,
50+
**kwargs,
51+
) -> None: ...
52+
@overload
53+
def __init__(
54+
self: tqdm_slack[NoReturn],
55+
iterable: None = ...,
56+
desc: str | None = ...,
57+
total: float | None = ...,
58+
leave: bool = ...,
59+
file: SupportsWrite[str] | None = ...,
60+
ncols: int | None = ...,
61+
mininterval: float = ...,
62+
maxinterval: float = ...,
63+
miniters: float | None = ...,
64+
ascii: bool | str | None = ...,
65+
disable: bool = ...,
66+
unit: str = ...,
67+
unit_scale: bool | float = ...,
68+
dynamic_ncols: bool = ...,
69+
smoothing: float = ...,
70+
bar_format: str | None = ...,
71+
initial: float = ...,
72+
position: int | None = ...,
73+
postfix: Mapping[str, object] | str | None = ...,
74+
unit_divisor: float = ...,
75+
write_bytes: bool | None = ...,
76+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
77+
nrows: int | None = ...,
78+
colour: str | None = ...,
79+
delay: float | None = ...,
80+
gui: bool = ...,
81+
token: str = ...,
82+
channel: int = ...,
83+
**kwargs,
84+
) -> None: ...
1985
def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override]
2086
def clear(self, *args, **kwargs) -> None: ...
2187

stubs/tqdm/tqdm/contrib/telegram.pyi

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from _typeshed import Incomplete
2-
from typing import Generic, TypeVar
1+
from _typeshed import Incomplete, SupportsWrite
2+
from collections.abc import Iterable, Mapping
3+
from typing import Generic, NoReturn, TypeVar, overload
34

45
from ..auto import tqdm as tqdm_auto
56
from .utils_worker import MonoWorker
@@ -20,7 +21,72 @@ _T = TypeVar("_T")
2021

2122
class tqdm_telegram(Generic[_T], tqdm_auto[_T]):
2223
tgio: Incomplete
23-
def __init__(self, *args, **kwargs) -> None: ...
24+
@overload
25+
def __init__(
26+
self,
27+
iterable: Iterable[_T],
28+
desc: str | None = ...,
29+
total: float | None = ...,
30+
leave: bool = ...,
31+
file: SupportsWrite[str] | None = ...,
32+
ncols: int | None = ...,
33+
mininterval: float = ...,
34+
maxinterval: float = ...,
35+
miniters: float | None = ...,
36+
ascii: bool | str | None = ...,
37+
disable: bool = ...,
38+
unit: str = ...,
39+
unit_scale: bool | float = ...,
40+
dynamic_ncols: bool = ...,
41+
smoothing: float = ...,
42+
bar_format: str | None = ...,
43+
initial: float = ...,
44+
position: int | None = ...,
45+
postfix: Mapping[str, object] | str | None = ...,
46+
unit_divisor: float = ...,
47+
write_bytes: bool | None = ...,
48+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
49+
nrows: int | None = ...,
50+
colour: str | None = ...,
51+
delay: float | None = ...,
52+
gui: bool = ...,
53+
token: str = ...,
54+
chat_id: str = ...,
55+
**kwargs,
56+
) -> None: ...
57+
@overload
58+
def __init__(
59+
self: tqdm_telegram[NoReturn],
60+
iterable: None = ...,
61+
desc: str | None = ...,
62+
total: float | None = ...,
63+
leave: bool = ...,
64+
file: SupportsWrite[str] | None = ...,
65+
ncols: int | None = ...,
66+
mininterval: float = ...,
67+
maxinterval: float = ...,
68+
miniters: float | None = ...,
69+
ascii: bool | str | None = ...,
70+
disable: bool = ...,
71+
unit: str = ...,
72+
unit_scale: bool | float = ...,
73+
dynamic_ncols: bool = ...,
74+
smoothing: float = ...,
75+
bar_format: str | None = ...,
76+
initial: float = ...,
77+
position: int | None = ...,
78+
postfix: Mapping[str, object] | str | None = ...,
79+
unit_divisor: float = ...,
80+
write_bytes: bool | None = ...,
81+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ...,
82+
nrows: int | None = ...,
83+
colour: str | None = ...,
84+
delay: float | None = ...,
85+
gui: bool = ...,
86+
token: str = ...,
87+
chat_id: str = ...,
88+
**kwargs,
89+
) -> None: ...
2490
def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override]
2591
def clear(self, *args, **kwargs) -> None: ...
2692
def close(self) -> None: ...

stubs/tqdm/tqdm/notebook.pyi

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import Incomplete, SupportsWrite
22
from collections.abc import Iterable, Iterator, Mapping
3-
from typing import Generic, TypeVar, overload
3+
from typing import Generic, NoReturn, TypeVar, overload
44

55
from .std import tqdm as std_tqdm, trange as trange
66

@@ -30,7 +30,7 @@ class tqdm_notebook(Generic[_T], std_tqdm[_T]):
3030
@overload
3131
def __init__(
3232
self,
33-
iterable: Iterable[_T] | None,
33+
iterable: Iterable[_T],
3434
desc: str | None = ...,
3535
total: float | None = ...,
3636
leave: bool = ...,
@@ -55,10 +55,13 @@ class tqdm_notebook(Generic[_T], std_tqdm[_T]):
5555
nrows: int | None = ...,
5656
colour: str | None = ...,
5757
delay: float | None = ...,
58+
display: bool = ...,
59+
**kwargs,
5860
) -> None: ...
5961
@overload
6062
def __init__(
61-
self,
63+
self: tqdm_notebook[NoReturn],
64+
iterable: None = ...,
6265
desc: str | None = ...,
6366
total: float | None = ...,
6467
leave: bool = ...,
@@ -83,6 +86,8 @@ class tqdm_notebook(Generic[_T], std_tqdm[_T]):
8386
nrows: int | None = ...,
8487
colour: str | None = ...,
8588
delay: float | None = ...,
89+
display: bool = ...,
90+
**kwargs,
8691
) -> None: ...
8792
def __iter__(self) -> Iterator[_T]: ...
8893
def update(self, n: int = ...): ... # type: ignore[override]

0 commit comments

Comments
 (0)