Skip to content

Commit 29d9aa9

Browse files
authored
Complete stubtest and fix Any subclassing in tqdm (#9525)
1 parent efee70a commit 29d9aa9

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1+
# Cannot import in stubtest
2+
tqdm.__main__
3+
# disco-py fails to install through pip and is an archived project
14
tqdm.contrib.discord
2-
3-
# Metaclass differs:
4-
tqdm.rich.FractionColumn
5-
tqdm.rich.RateColumn

stubs/tqdm/METADATA.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version = "4.64.*"
22

33
[tool.stubtest]
4+
ignore_missing_stub = false
45
extras = ["slack", "telegram"]

stubs/tqdm/tqdm/rich.pyi

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
from _typeshed import Incomplete, SupportsWrite
2+
from abc import ABC, abstractmethod
23
from collections.abc import Iterable, Mapping
3-
from typing import Any, Generic, NoReturn, TypeVar, overload
4-
from typing_extensions import TypeAlias
4+
from typing import Generic, NoReturn, TypeVar, overload
55

66
from .std import tqdm as std_tqdm
77

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

10-
_ProgressColumn: TypeAlias = Any # Actually rich.progress.ProgressColumn
10+
# Actually rich.progress.ProgressColumn
11+
class _ProgressColumn(ABC):
12+
max_refresh: float | None
13+
def __init__(self, table_column: Incomplete | None = ...) -> None: ...
14+
def get_table_column(self) -> Incomplete: ...
15+
def __call__(self, task: Incomplete) -> Incomplete: ...
16+
@abstractmethod
17+
def render(self, task: Incomplete) -> Incomplete: ...
1118

1219
class FractionColumn(_ProgressColumn):
1320
unit_scale: bool

0 commit comments

Comments
 (0)