Complete stubtest and fix Any subclassing in tqdm (#9525)

This commit is contained in:
Avasam
2023-02-06 19:15:44 -05:00
committed by GitHub
parent efee70abfa
commit 29d9aa9b28
3 changed files with 14 additions and 7 deletions

View File

@@ -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

View File

@@ -1,4 +1,5 @@
version = "4.64.*"
[tool.stubtest]
ignore_missing_stub = false
extras = ["slack", "telegram"]

View File

@@ -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