Skip to content

Complete stubtest and fix any subclassing in tqdm #9525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 7, 2023
7 changes: 3 additions & 4 deletions stubs/tqdm/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Cannot import in stubtest
tqdm.__main__
# disco-py fails to install through pip and is an archived project
tqdm.contrib.discord

# Metaclass differs:
tqdm.rich.FractionColumn
tqdm.rich.RateColumn
1 change: 1 addition & 0 deletions stubs/tqdm/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version = "4.64.*"

[tool.stubtest]
ignore_missing_stub = false
extras = ["slack", "telegram"]
13 changes: 10 additions & 3 deletions stubs/tqdm/tqdm/rich.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from _typeshed import Incomplete, SupportsWrite
from abc import ABC, abstractmethod
from collections.abc import Iterable, Mapping
from typing import Any, Generic, NoReturn, TypeVar, overload
from typing_extensions import TypeAlias
from typing import Generic, NoReturn, TypeVar, overload

from .std import tqdm as std_tqdm

__all__ = ["tqdm_rich", "trrange", "tqdm", "trange"]

_ProgressColumn: TypeAlias = Any # Actually rich.progress.ProgressColumn
# Actually rich.progress.ProgressColumn
class _ProgressColumn(ABC):
max_refresh: float | None
def __init__(self, table_column: Incomplete | None = ...) -> None: ...
def get_table_column(self) -> Incomplete: ...
def __call__(self, task: Incomplete) -> Incomplete: ...
@abstractmethod
def render(self, task: Incomplete) -> Incomplete: ...

class FractionColumn(_ProgressColumn):
unit_scale: bool
Expand Down