Fix some Any subclassing in tqdm (#9505)

This commit is contained in:
Avasam
2023-01-13 03:10:21 -05:00
committed by GitHub
parent 9a76e5a669
commit 102a8fa38c
2 changed files with 42 additions and 7 deletions

View File

@@ -1,10 +1,24 @@
from _typeshed import Incomplete
from typing import Any
from typing_extensions import TypeAlias
from _typeshed import Incomplete, Self
from collections.abc import Callable
from typing import ClassVar
__all__ = ["TqdmCallback"]
_Callback: TypeAlias = Any # Actually dask.callbacks.Callback
# dask.callbacks.Callback
class _Callback:
active: ClassVar[set[tuple[Callable[..., Incomplete] | None, ...]]]
def __init__(
self,
start: Incomplete | None,
start_state: Incomplete | None,
pretask: Incomplete | None,
posttask: Incomplete | None,
finish: Incomplete | None,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args) -> None: ...
def register(self) -> None: ...
def unregister(self) -> None: ...
class TqdmCallback(_Callback):
tqdm_class: type[Incomplete]

View File

@@ -1,10 +1,31 @@
from _typeshed import Incomplete
from typing import Any
from typing_extensions import TypeAlias
__all__ = ["TqdmCallback"]
_Callback: TypeAlias = Any # Actually tensorflow.keras.callbacks.Callback
# keras.callbacks.Callback
class _Callback:
validation_data: Incomplete | None
model: Incomplete | None
params: Incomplete
def __init__(self) -> None: ...
def set_params(self, params) -> None: ...
def set_model(self, model) -> None: ...
def on_batch_begin(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_batch_end(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_epoch_begin(self, epoch, logs: Incomplete | None = ...) -> None: ...
def on_epoch_end(self, epoch, logs: Incomplete | None = ...) -> None: ...
def on_train_batch_begin(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_train_batch_end(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_test_batch_begin(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_test_batch_end(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_predict_batch_begin(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_predict_batch_end(self, batch, logs: Incomplete | None = ...) -> None: ...
def on_train_begin(self, logs: Incomplete | None = ...) -> None: ...
def on_train_end(self, logs: Incomplete | None = ...) -> None: ...
def on_test_begin(self, logs: Incomplete | None = ...) -> None: ...
def on_test_end(self, logs: Incomplete | None = ...) -> None: ...
def on_predict_begin(self, logs: Incomplete | None = ...) -> None: ...
def on_predict_end(self, logs: Incomplete | None = ...) -> None: ...
class TqdmCallback(_Callback):
@staticmethod