Skip to content

Fix some Any subclassing in tqdm #9505

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 4 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions stubs/tqdm/tqdm/dask.pyi
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
27 changes: 24 additions & 3 deletions stubs/tqdm/tqdm/keras.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down