mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Improve tqdm.contrib.logging context managers (#8251)
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import logging
|
||||
from collections.abc import Iterator, Sequence
|
||||
from typing import Any
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from typing import Any, TypeVar, overload
|
||||
|
||||
from ..std import tqdm as std_tqdm
|
||||
|
||||
_TqdmT = TypeVar("_TqdmT", bound=std_tqdm[Any])
|
||||
|
||||
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]: ...
|
||||
) -> _GeneratorContextManager[None]: ...
|
||||
|
||||
# TODO type *args, **kwargs here more precisely
|
||||
@overload
|
||||
def tqdm_logging_redirect(*args, tqdm_class: Callable[..., _TqdmT], **kwargs) -> _GeneratorContextManager[_TqdmT]: ...
|
||||
@overload
|
||||
def tqdm_logging_redirect(*args, **kwargs) -> _GeneratorContextManager[std_tqdm[Incomplete]]: ...
|
||||
|
||||
Reference in New Issue
Block a user