diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index e08236b17..374b5572f 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -71,6 +71,7 @@ "stubs/slumber", "stubs/SQLAlchemy", "stubs/stripe", + "stubs/tqdm", "stubs/ttkthemes", "stubs/urllib3", "stubs/vobject" diff --git a/stubs/tqdm/@tests/requirements-stubtest.txt b/stubs/tqdm/@tests/requirements-stubtest.txt new file mode 100644 index 000000000..dd9c059ca --- /dev/null +++ b/stubs/tqdm/@tests/requirements-stubtest.txt @@ -0,0 +1,6 @@ +tensorflow +pandas +dask +rich +requests +slack-sdk diff --git a/stubs/tqdm/@tests/stubtest_allowlist.txt b/stubs/tqdm/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000..aff04d2ae --- /dev/null +++ b/stubs/tqdm/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +tqdm.contrib.discord diff --git a/stubs/tqdm/METADATA.toml b/stubs/tqdm/METADATA.toml new file mode 100644 index 000000000..328bb0b8b --- /dev/null +++ b/stubs/tqdm/METADATA.toml @@ -0,0 +1 @@ +version = "4.64.*" diff --git a/stubs/tqdm/tqdm/__init__.pyi b/stubs/tqdm/tqdm/__init__.pyi new file mode 100644 index 000000000..13be70a26 --- /dev/null +++ b/stubs/tqdm/tqdm/__init__.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete + +from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning +from ._tqdm_pandas import tqdm_pandas as tqdm_pandas +from .cli import main as main +from .gui import tqdm as tqdm_gui, trange as tgrange +from .notebook import tqdm_notebook as tqdm_notebook_cls +from .std import ( + TqdmDeprecationWarning as TqdmDeprecationWarning, + TqdmExperimentalWarning as TqdmExperimentalWarning, + TqdmKeyError as TqdmKeyError, + TqdmMonitorWarning as TqdmMonitorWarning, + TqdmTypeError as TqdmTypeError, + TqdmWarning as TqdmWarning, + tqdm as tqdm, + trange as trange, +) + +def tqdm_notebook(*args, **kwargs) -> tqdm_notebook_cls[Incomplete]: ... +def tnrange(*args, **kwargs) -> tqdm_notebook_cls[int]: ... diff --git a/stubs/tqdm/tqdm/_dist_ver.pyi b/stubs/tqdm/tqdm/_dist_ver.pyi new file mode 100644 index 000000000..e69de29bb diff --git a/stubs/tqdm/tqdm/_main.pyi b/stubs/tqdm/tqdm/_main.pyi new file mode 100644 index 000000000..81525aa3c --- /dev/null +++ b/stubs/tqdm/tqdm/_main.pyi @@ -0,0 +1,4 @@ +from .cli import * + +# Names in __all__ with no definition: +# main diff --git a/stubs/tqdm/tqdm/_monitor.pyi b/stubs/tqdm/tqdm/_monitor.pyi new file mode 100644 index 000000000..f8b6e44d4 --- /dev/null +++ b/stubs/tqdm/tqdm/_monitor.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete +from threading import Thread + +class TqdmSynchronisationWarning(RuntimeWarning): ... + +class TMonitor(Thread): + daemon: bool + woken: int + tqdm_cls: type[Incomplete] + sleep_interval: float + was_killed: Incomplete + def __init__(self, tqdm_cls: type[Incomplete], sleep_interval: float) -> None: ... + def exit(self): ... + def get_instances(self): ... + def run(self) -> None: ... + def report(self): ... diff --git a/stubs/tqdm/tqdm/_tqdm.pyi b/stubs/tqdm/tqdm/_tqdm.pyi new file mode 100644 index 000000000..e2796836c --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm.pyi @@ -0,0 +1,11 @@ +from .std import * +from .std import TqdmDeprecationWarning as TqdmDeprecationWarning + +# Names in __all__ with no definition: +# TqdmExperimentalWarning +# TqdmKeyError +# TqdmMonitorWarning +# TqdmTypeError +# TqdmWarning +# tqdm +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_gui.pyi b/stubs/tqdm/tqdm/_tqdm_gui.pyi new file mode 100644 index 000000000..4c489bd2f --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_gui.pyi @@ -0,0 +1,7 @@ +from .gui import * + +# Names in __all__ with no definition: +# tgrange +# tqdm +# tqdm_gui +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_notebook.pyi b/stubs/tqdm/tqdm/_tqdm_notebook.pyi new file mode 100644 index 000000000..5c9a36126 --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_notebook.pyi @@ -0,0 +1,7 @@ +from .notebook import * + +# Names in __all__ with no definition: +# tnrange +# tqdm +# tqdm_notebook +# trange diff --git a/stubs/tqdm/tqdm/_tqdm_pandas.pyi b/stubs/tqdm/tqdm/_tqdm_pandas.pyi new file mode 100644 index 000000000..434c1fc3a --- /dev/null +++ b/stubs/tqdm/tqdm/_tqdm_pandas.pyi @@ -0,0 +1 @@ +def tqdm_pandas(tclass, **tqdm_kwargs) -> None: ... diff --git a/stubs/tqdm/tqdm/_utils.pyi b/stubs/tqdm/tqdm/_utils.pyi new file mode 100644 index 000000000..2d60c39ae --- /dev/null +++ b/stubs/tqdm/tqdm/_utils.pyi @@ -0,0 +1,10 @@ +from .std import TqdmDeprecationWarning as TqdmDeprecationWarning +from .utils import ( + CUR_OS as CUR_OS, + IS_NIX as IS_NIX, + IS_WIN as IS_WIN, + RE_ANSI as RE_ANSI, + Comparable as Comparable, + FormatReplace as FormatReplace, + SimpleTextIOWrapper as SimpleTextIOWrapper, +) diff --git a/stubs/tqdm/tqdm/asyncio.pyi b/stubs/tqdm/tqdm/asyncio.pyi new file mode 100644 index 000000000..65b15da2f --- /dev/null +++ b/stubs/tqdm/tqdm/asyncio.pyi @@ -0,0 +1,206 @@ +from _typeshed import Incomplete, Self, SupportsWrite +from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +_T = TypeVar("_T") + +class tqdm_asyncio(Generic[_T], std_tqdm[_T]): + iterable_awaitable: bool + iterable_next: Callable[[], _T | Awaitable[_T]] + iterable_iterator: Iterator[_T] + + def __aiter__(self: Self) -> Self: ... + async def __anext__(self) -> Awaitable[_T]: ... + def send(self, *args, **kwargs): ... + @classmethod + def as_completed( + cls, + fs: Iterable[Awaitable[_T]], + *, + loop: bool | None = ..., + timeout: float | None = ..., + total: int | None = ..., + desc: str | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> Generator[Incomplete, Incomplete, None]: ... + @classmethod + async def gather( + cls, + *fs: Awaitable[_T], + loop: bool | None = ..., + timeout: float | None = ..., + total: int | None = ..., + iterable: Iterable[_T] = ..., + desc: str | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ): ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_asyncio[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +@overload +def tarange( + start: int, + stop: int, + step: int | None = ..., + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm_asyncio[int]: ... +@overload +def tarange( + stop: int, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm_asyncio[int]: ... + +tqdm = tqdm_asyncio +trange = tarange diff --git a/stubs/tqdm/tqdm/auto.pyi b/stubs/tqdm/tqdm/auto.pyi new file mode 100644 index 000000000..c400fe8db --- /dev/null +++ b/stubs/tqdm/tqdm/auto.pyi @@ -0,0 +1 @@ +from .asyncio import tqdm as tqdm, trange as trange diff --git a/stubs/tqdm/tqdm/autonotebook.pyi b/stubs/tqdm/tqdm/autonotebook.pyi new file mode 100644 index 000000000..fb095861d --- /dev/null +++ b/stubs/tqdm/tqdm/autonotebook.pyi @@ -0,0 +1 @@ +from .std import tqdm as tqdm, trange as trange diff --git a/stubs/tqdm/tqdm/cli.pyi b/stubs/tqdm/tqdm/cli.pyi new file mode 100644 index 000000000..adaae5389 --- /dev/null +++ b/stubs/tqdm/tqdm/cli.pyi @@ -0,0 +1,3 @@ +from collections.abc import Sequence + +def main(fp=..., argv: Sequence[str] | None = ...) -> None: ... diff --git a/stubs/tqdm/tqdm/contrib/__init__.pyi b/stubs/tqdm/tqdm/contrib/__init__.pyi new file mode 100644 index 000000000..3e8d13361 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/__init__.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete +from collections.abc import Callable, Generator + +from ..utils import ObjectWrapper + +class DummyTqdmFile(ObjectWrapper): + def __init__(self, wrapped) -> None: ... + def write(self, x, nolock: bool = ...) -> None: ... + def __del__(self) -> None: ... + +def tenumerate(iterable, start: int = ..., total: Incomplete | None = ..., tqdm_class: type[Incomplete] = ..., **tqdm_kwargs): ... +def tzip(iter1, *iter2plus, **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... +def tmap(function: Callable[..., Incomplete], *sequences, **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/tqdm/tqdm/contrib/bells.pyi b/stubs/tqdm/tqdm/contrib/bells.pyi new file mode 100644 index 000000000..662e91788 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/bells.pyi @@ -0,0 +1 @@ +from ..auto import tqdm as tqdm, trange as trange diff --git a/stubs/tqdm/tqdm/contrib/concurrent.pyi b/stubs/tqdm/tqdm/contrib/concurrent.pyi new file mode 100644 index 000000000..99349410f --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/concurrent.pyi @@ -0,0 +1,2 @@ +def thread_map(fn, *iterables, **tqdm_kwargs): ... +def process_map(fn, *iterables, **tqdm_kwargs): ... diff --git a/stubs/tqdm/tqdm/contrib/discord.pyi b/stubs/tqdm/tqdm/contrib/discord.pyi new file mode 100644 index 000000000..d83a245fd --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/discord.pyi @@ -0,0 +1,31 @@ +from _typeshed import Incomplete +from typing import Generic, TypeVar + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +class DiscordIO(MonoWorker): + text: Incomplete + message: Incomplete + def __init__(self, token, channel_id) -> None: ... + def write(self, s): ... + +_T = TypeVar("_T") + +class tqdm_discord(Generic[_T], tqdm_auto[_T]): + dio: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def display( + self, + msg: str | None = ..., + pos: int | None = ..., + close: bool = ..., + bar_style: Incomplete = ..., + check_delay: bool = ..., + ) -> None: ... + def clear(self, *args, **kwargs) -> None: ... + +def tdrange(*args, **kwargs) -> tqdm_discord[int]: ... + +tqdm = tqdm_discord +trange = tdrange diff --git a/stubs/tqdm/tqdm/contrib/itertools.pyi b/stubs/tqdm/tqdm/contrib/itertools.pyi new file mode 100644 index 000000000..7a2aa148f --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/itertools.pyi @@ -0,0 +1,4 @@ +from _typeshed import Incomplete +from collections.abc import Generator, Iterable + +def product(*iterables: Iterable[Incomplete], **tqdm_kwargs) -> Generator[Incomplete, None, None]: ... diff --git a/stubs/tqdm/tqdm/contrib/logging.pyi b/stubs/tqdm/tqdm/contrib/logging.pyi new file mode 100644 index 000000000..b7551e10c --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/logging.pyi @@ -0,0 +1,10 @@ +import logging +from collections.abc import Iterator, Sequence +from typing import Any + +from ..std import tqdm as std_tqdm + +def logging_redirect_tqdm( + loggers: Sequence[logging.Logger] | None = ..., tqdm_class: type[std_tqdm[Any]] = ... +) -> Iterator[None]: ... +def tqdm_logging_redirect(*args, **kwargs) -> Iterator[None]: ... diff --git a/stubs/tqdm/tqdm/contrib/slack.pyi b/stubs/tqdm/tqdm/contrib/slack.pyi new file mode 100644 index 000000000..4c6267223 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/slack.pyi @@ -0,0 +1,25 @@ +from _typeshed import Incomplete +from typing import Generic, TypeVar + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +class SlackIO(MonoWorker): + client: Incomplete + text: Incomplete + message: Incomplete + def __init__(self, token, channel) -> None: ... + def write(self, s): ... + +_T = TypeVar("_T") + +class tqdm_slack(Generic[_T], tqdm_auto[_T]): + sio: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override] + def clear(self, *args, **kwargs) -> None: ... + +def tsrange(*args, **kwargs) -> tqdm_slack[int]: ... + +tqdm = tqdm_slack +trange = tsrange diff --git a/stubs/tqdm/tqdm/contrib/telegram.pyi b/stubs/tqdm/tqdm/contrib/telegram.pyi new file mode 100644 index 000000000..710a1f7d4 --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/telegram.pyi @@ -0,0 +1,31 @@ +from _typeshed import Incomplete +from typing import Generic, TypeVar + +from ..auto import tqdm as tqdm_auto +from .utils_worker import MonoWorker + +class TelegramIO(MonoWorker): + API: str + token: Incomplete + chat_id: Incomplete + session: Incomplete + text: Incomplete + def __init__(self, token, chat_id) -> None: ... + @property + def message_id(self): ... + def write(self, s: str) -> Incomplete | None: ... + def delete(self): ... + +_T = TypeVar("_T") + +class tqdm_telegram(Generic[_T], tqdm_auto[_T]): + tgio: Incomplete + def __init__(self, *args, **kwargs) -> None: ... + def display(self, *, msg: str | None = ..., pos: int | None = ..., close: bool = ..., bar_style: Incomplete = ..., check_delay: bool = ...) -> None: ... # type: ignore[override] + def clear(self, *args, **kwargs) -> None: ... + def close(self) -> None: ... + +def ttgrange(*args, **kwargs) -> tqdm_telegram[int]: ... + +tqdm = tqdm_telegram +trange = ttgrange diff --git a/stubs/tqdm/tqdm/contrib/utils_worker.pyi b/stubs/tqdm/tqdm/contrib/utils_worker.pyi new file mode 100644 index 000000000..6748b1d1d --- /dev/null +++ b/stubs/tqdm/tqdm/contrib/utils_worker.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete +from collections import deque +from collections.abc import Callable +from concurrent.futures import Future, ThreadPoolExecutor +from typing import TypeVar +from typing_extensions import ParamSpec + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +class MonoWorker: + pool: ThreadPoolExecutor + futures: deque[Future[Incomplete]] + def __init__(self) -> None: ... + def submit(self, func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> Future[_R]: ... diff --git a/stubs/tqdm/tqdm/dask.pyi b/stubs/tqdm/tqdm/dask.pyi new file mode 100644 index 000000000..dd1a32285 --- /dev/null +++ b/stubs/tqdm/tqdm/dask.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete +from typing import Any +from typing_extensions import TypeAlias + +_Callback: TypeAlias = Any # Actually dask.callbacks.Callback + +class TqdmCallback(_Callback): + tqdm_class: type[Incomplete] + def __init__( + self, start: Incomplete | None = ..., pretask: Incomplete | None = ..., tqdm_class: type[Incomplete] = ..., **tqdm_kwargs + ) -> None: ... + def display(self) -> None: ... diff --git a/stubs/tqdm/tqdm/gui.pyi b/stubs/tqdm/tqdm/gui.pyi new file mode 100644 index 000000000..b379cc71d --- /dev/null +++ b/stubs/tqdm/tqdm/gui.pyi @@ -0,0 +1,90 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +_T = TypeVar("_T") + +class tqdm_gui(Generic[_T], std_tqdm[_T]): + mpl: Incomplete + plt: Incomplete + toolbar: Incomplete + mininterval: Incomplete + xdata: Incomplete + ydata: Incomplete + zdata: Incomplete + hspan: Incomplete + wasion: Incomplete + ax: Incomplete + disable: bool + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_gui[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +def tgrange(*args, **kwargs) -> tqdm_gui[int]: ... + +tqdm = tqdm_gui +trange = tgrange diff --git a/stubs/tqdm/tqdm/keras.pyi b/stubs/tqdm/tqdm/keras.pyi new file mode 100644 index 000000000..30dc90e7e --- /dev/null +++ b/stubs/tqdm/tqdm/keras.pyi @@ -0,0 +1,29 @@ +from _typeshed import Incomplete +from typing import Any +from typing_extensions import TypeAlias + +_Callback: TypeAlias = Any # Actually tensorflow.keras.callbacks.Callback + +class TqdmCallback(_Callback): + @staticmethod + def bar2callback(bar, pop: Incomplete | None = ..., delta=...): ... + tqdm_class: Incomplete + epoch_bar: Incomplete + on_epoch_end: Incomplete + batches: Incomplete + verbose: Incomplete + batch_bar: Incomplete + on_batch_end: Incomplete + def __init__( + self, + epochs: Incomplete | None = ..., + data_size: Incomplete | None = ..., + batch_size: Incomplete | None = ..., + verbose: int = ..., + tqdm_class=..., + **tqdm_kwargs, + ) -> None: ... + def on_train_begin(self, *_, **__) -> None: ... + def on_epoch_begin(self, epoch, *_, **__) -> None: ... + def on_train_end(self, *_, **__) -> None: ... + def display(self) -> None: ... diff --git a/stubs/tqdm/tqdm/notebook.pyi b/stubs/tqdm/tqdm/notebook.pyi new file mode 100644 index 000000000..6e7848b87 --- /dev/null +++ b/stubs/tqdm/tqdm/notebook.pyi @@ -0,0 +1,94 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Iterator, Mapping +from typing import Generic, TypeVar, overload + +from .std import tqdm as std_tqdm, trange as trange + +_T = TypeVar("_T") + +class tqdm_notebook(Generic[_T], std_tqdm[_T]): + @staticmethod + def status_printer( + _: SupportsWrite[str] | None, total: float | None = ..., desc: str | None = ..., ncols: int | None = ... + ): ... + displayed: bool + def display( + self, + msg: str | None = ..., + pos: int | None = ..., + close: bool = ..., + bar_style: str | None = ..., + check_delay: bool = ..., + ) -> None: ... + @property + def colour(self): ... + @colour.setter + def colour(self, bar_color: str) -> None: ... + disp: Incomplete + ncols: Incomplete + container: Incomplete + @overload + def __init__( + self, + iterable: Iterable[_T] | None, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> None: ... + @overload + def __init__( + self, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> None: ... + def __iter__(self) -> Iterator[_T]: ... + def update(self, n: int = ...): ... # type: ignore[override] + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def reset(self, total: float | None = ...): ... + +tqdm = tqdm_notebook +tnrange = trange diff --git a/stubs/tqdm/tqdm/rich.pyi b/stubs/tqdm/tqdm/rich.pyi new file mode 100644 index 000000000..69b13ff66 --- /dev/null +++ b/stubs/tqdm/tqdm/rich.pyi @@ -0,0 +1,98 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Any, Generic, NoReturn, TypeVar, overload +from typing_extensions import TypeAlias + +from .std import tqdm as std_tqdm + +_ProgressColumn: TypeAlias = Any # Actually rich.progress.ProgressColumn + +class FractionColumn(_ProgressColumn): + unit_scale: bool + unit_divisor: int + + def __init__(self, unit_scale: bool = ..., unit_divisor: int = ...) -> None: ... + def render(self, task): ... + +class RateColumn(_ProgressColumn): + unit: str + unit_scale: bool + unit_divisor: int + + def __init__(self, unit: str = ..., unit_scale: bool = ..., unit_divisor: int = ...) -> None: ... + def render(self, task): ... + +_T = TypeVar("_T") + +class tqdm_rich(Generic[_T], std_tqdm[_T]): + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + def reset(self, total: Incomplete | None = ...) -> None: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_rich[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + +def trrange(*args, **kwargs) -> tqdm_rich[int]: ... + +tqdm = tqdm_rich +trange = trrange diff --git a/stubs/tqdm/tqdm/std.pyi b/stubs/tqdm/tqdm/std.pyi new file mode 100644 index 000000000..5f0a2597c --- /dev/null +++ b/stubs/tqdm/tqdm/std.pyi @@ -0,0 +1,274 @@ +import contextlib +from _typeshed import Incomplete, Self, SupportsWrite +from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping +from typing import Any, ClassVar, Generic, NoReturn, TypeVar, overload +from typing_extensions import Literal + +from .utils import Comparable + +class TqdmTypeError(TypeError): ... +class TqdmKeyError(KeyError): ... + +class TqdmWarning(Warning): + def __init__(self, msg, fp_write: Incomplete | None = ..., *a, **k) -> None: ... + +class TqdmExperimentalWarning(TqdmWarning, FutureWarning): ... +class TqdmDeprecationWarning(TqdmWarning, DeprecationWarning): ... +class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): ... + +_T = TypeVar("_T") + +class tqdm(Generic[_T], Iterable[_T], Comparable): + monitor_interval: ClassVar[int] + + @staticmethod + def format_sizeof(num: float, suffix: str = ..., divisor: float = ...) -> str: ... + @staticmethod + def format_interval(t: float) -> str: ... + @staticmethod + def format_num(n: float) -> str: ... + @staticmethod + def status_printer(file: SupportsWrite[str]) -> Callable[[str], None]: ... + @staticmethod + def format_meter( + n: float, + total: float, + elapsed: float, + ncols: int | None = ..., + prefix: str | None = ..., + ascii: bool | str | None = ..., + unit: str | None = ..., + unit_scale: bool | float | None = ..., + rate: float | None = ..., + bar_format: str | None = ..., + postfix: str | Mapping[str, object] | None = ..., + unit_divisor: float | None = ..., + initial: float | None = ..., + colour: str | None = ..., + ) -> str: ... + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + **kwargs, + ) -> None: ... + def __new__(cls: type[Self], *_, **__) -> Self: ... + @classmethod + def write(cls, s: str, file: SupportsWrite[str] | None = ..., end: str = ..., nolock: bool = ...) -> None: ... + @classmethod + def external_write_mode( + cls, file: SupportsWrite[str] | None = ..., nolock: bool = ... + ) -> contextlib._GeneratorContextManager[None]: ... + @classmethod + def set_lock(cls, lock) -> None: ... + @classmethod + def get_lock(cls): ... + @classmethod + def pandas( + cls, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + ) -> None: ... + + iterable: Incomplete + disable: Incomplete + pos: Incomplete + n: Incomplete + total: Incomplete + leave: Incomplete + desc: Incomplete + fp: Incomplete + ncols: Incomplete + nrows: Incomplete + mininterval: Incomplete + maxinterval: Incomplete + miniters: Incomplete + dynamic_miniters: Incomplete + ascii: Incomplete + unit: Incomplete + unit_scale: Incomplete + unit_divisor: Incomplete + initial: Incomplete + lock_args: Incomplete + delay: Incomplete + gui: Incomplete + dynamic_ncols: Incomplete + smoothing: Incomplete + bar_format: Incomplete + postfix: Incomplete + colour: Incomplete + last_print_n: Incomplete + sp: Incomplete + last_print_t: Incomplete + start_t: Incomplete + + def __bool__(self) -> bool: ... + def __nonzero__(self) -> bool: ... + def __len__(self) -> int: ... + def __reversed__(self) -> Iterator[_T]: ... + def __contains__(self, item: object) -> bool: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... + def __del__(self) -> None: ... + def __hash__(self) -> int: ... + def __iter__(self) -> Iterator[_T]: ... + def update(self, n: float | None = ...) -> bool | None: ... + def close(self) -> None: ... + def clear(self, nolock: bool = ...) -> None: ... + def refresh( + self, nolock: bool = ..., lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ... + ) -> None: ... + def unpause(self) -> None: ... + def reset(self, total: float | None = ...) -> None: ... + def set_description(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def set_description_str(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def set_postfix(self, ordered_dict: Mapping[str, object] | None = ..., refresh: bool | None = ..., **kwargs) -> None: ... + def set_postfix_str(self, s: str = ..., refresh: bool = ...) -> None: ... + def moveto(self, n) -> None: ... + @property + def format_dict(self) -> MutableMapping[str, Any]: ... + def display(self, msg: str | None = ..., pos: int | None = ...) -> None: ... + @classmethod + def wrapattr( + cls, stream, method: Literal["read", "write"], total: float | None = ..., bytes: bool | None = ..., **tqdm_kwargs + ) -> contextlib._GeneratorContextManager[Incomplete]: ... + +@overload +def trange( + start: int, + stop: int, + step: int | None = ..., + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm[int]: ... +@overload +def trange( + stop: int, + *, + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., +) -> tqdm[int]: ... diff --git a/stubs/tqdm/tqdm/tk.pyi b/stubs/tqdm/tqdm/tk.pyi new file mode 100644 index 000000000..53241d3b7 --- /dev/null +++ b/stubs/tqdm/tqdm/tk.pyi @@ -0,0 +1,91 @@ +from _typeshed import Incomplete, SupportsWrite +from collections.abc import Iterable, Mapping +from typing import Generic, NoReturn, TypeVar, overload + +from .std import tqdm as std_tqdm + +_T = TypeVar("_T") + +class tqdm_tk(Generic[_T], std_tqdm[_T]): + @overload + def __init__( + self, + iterable: Iterable[_T], + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + grab=..., + tk_parent=..., + cancel_callback=..., + **kwargs, + ) -> None: ... + @overload + def __init__( + self: tqdm_tk[NoReturn], + iterable: None = ..., + desc: str | None = ..., + total: float | None = ..., + leave: bool = ..., + file: SupportsWrite[str] | None = ..., + ncols: int | None = ..., + mininterval: float = ..., + maxinterval: float = ..., + miniters: float | None = ..., + ascii: bool | str | None = ..., + disable: bool = ..., + unit: str = ..., + unit_scale: bool | float = ..., + dynamic_ncols: bool = ..., + smoothing: float = ..., + bar_format: str | None = ..., + initial: float = ..., + position: int | None = ..., + postfix: Mapping[str, object] | str | None = ..., + unit_divisor: float = ..., + write_bytes: bool | None = ..., + lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = ..., + nrows: int | None = ..., + colour: str | None = ..., + delay: float | None = ..., + gui: bool = ..., + grab=..., + tk_parent=..., + cancel_callback=..., + **kwargs, + ) -> None: ... + disable: bool + def close(self) -> None: ... + def clear(self, *_, **__) -> None: ... + def display(self, *_, **__) -> None: ... + def set_description(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + desc: Incomplete + def set_description_str(self, desc: str | None = ..., refresh: bool | None = ...) -> None: ... + def cancel(self) -> None: ... + def reset(self, total: Incomplete | None = ...) -> None: ... + +def ttkrange(*args, **kwargs) -> tqdm_tk[int]: ... + +tqdm = tqdm_tk +trange = ttkrange diff --git a/stubs/tqdm/tqdm/utils.pyi b/stubs/tqdm/tqdm/utils.pyi new file mode 100644 index 000000000..76b9ca621 --- /dev/null +++ b/stubs/tqdm/tqdm/utils.pyi @@ -0,0 +1,54 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from typing import Pattern, Protocol, TypeVar +from typing_extensions import ParamSpec + +CUR_OS: str +IS_WIN: bool +IS_NIX: bool +RE_ANSI: Pattern[str] + +class FormatReplace: + replace: str + format_called: int + def __init__(self, replace: str = ...) -> None: ... + def __format__(self, _) -> str: ... + +class _Has__Comparable(Protocol): + _comparable: Incomplete + +class Comparable: + _comparable: Incomplete + def __lt__(self, other: _Has__Comparable) -> bool: ... + def __le__(self, other: _Has__Comparable) -> bool: ... + def __eq__(self, other: _Has__Comparable) -> bool: ... # type: ignore[override] + def __ne__(self, other: _Has__Comparable) -> bool: ... # type: ignore[override] + def __gt__(self, other: _Has__Comparable) -> bool: ... + def __ge__(self, other: _Has__Comparable) -> bool: ... + +class ObjectWrapper: + def __getattr__(self, name: str): ... + def __setattr__(self, name: str, value) -> None: ... + def wrapper_getattr(self, name): ... + def wrapper_setattr(self, name, value): ... + def __init__(self, wrapped) -> None: ... + +class SimpleTextIOWrapper(ObjectWrapper): + def __init__(self, wrapped, encoding) -> None: ... + def write(self, s: str): ... + def __eq__(self, other: object) -> bool: ... + +_P = ParamSpec("_P") +_R = TypeVar("_R") + +class DisableOnWriteError(ObjectWrapper): + @staticmethod + def disable_on_exception(tqdm_instance, func: Callable[_P, _R]) -> Callable[_P, _R]: ... + def __init__(self, wrapped, tqdm_instance) -> None: ... + def __eq__(self, other: object) -> bool: ... + +class CallbackIOWrapper(ObjectWrapper): + def __init__(self, callback: Callable[[int], object], stream, method: str = ...) -> None: ... + +def disp_len(data: str) -> int: ... +def disp_trim(data: str, length: int) -> str: ... diff --git a/stubs/tqdm/tqdm/version.pyi b/stubs/tqdm/tqdm/version.pyi new file mode 100644 index 000000000..e69de29bb