Consistently use Generic as the last base class (#10610)

This commit is contained in:
Nikita Sobolev
2023-08-28 11:16:54 +03:00
committed by GitHub
parent 3b9ab5e9b1
commit 2c1db00761
15 changed files with 17 additions and 17 deletions

View File

@@ -345,7 +345,7 @@ class GradientTape:
_SpecProto = TypeVar("_SpecProto", bound=Message)
class TypeSpec(Generic[_SpecProto], ABC):
class TypeSpec(ABC, Generic[_SpecProto]):
@property
@abstractmethod
def value_type(self) -> Any: ...

View File

@@ -27,7 +27,7 @@ class Iterator(_Iterator[_T1], Trackable, ABC):
@abstractmethod
def get_next_as_optional(self) -> tf.experimental.Optional[_T1]: ...
class Dataset(Generic[_T1], ABC):
class Dataset(ABC, Generic[_T1]):
def apply(self, transformation_func: Callable[[Dataset[_T1]], Dataset[_T2]]) -> Dataset[_T2]: ...
def as_numpy_iterator(self) -> Iterator[np.ndarray[Any, Any]]: ...
def batch(

View File

@@ -4,7 +4,7 @@ from typing import Generic, TypeVar
_T_co = TypeVar("_T_co", covariant=True)
class Optional(Generic[_T_co], ABC):
class Optional(ABC, Generic[_T_co]):
def __getattr__(self, name: str) -> Incomplete: ...
def __getattr__(name: str) -> Incomplete: ...

View File

@@ -9,7 +9,7 @@ __all__ = ["tqdm_asyncio", "tarange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_asyncio(Generic[_T], std_tqdm[_T]):
class tqdm_asyncio(std_tqdm[_T], Generic[_T]):
iterable_awaitable: bool
iterable_next: Callable[[], _T | Awaitable[_T]]
iterable_iterator: Iterator[_T]

View File

@@ -15,7 +15,7 @@ class DiscordIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_discord(Generic[_T], tqdm_auto[_T]):
class tqdm_discord(tqdm_auto[_T], Generic[_T]):
dio: Incomplete
@overload
def __init__(

View File

@@ -16,7 +16,7 @@ class SlackIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_slack(Generic[_T], tqdm_auto[_T]):
class tqdm_slack(tqdm_auto[_T], Generic[_T]):
sio: Incomplete
@overload
def __init__(

View File

@@ -21,7 +21,7 @@ class TelegramIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_telegram(Generic[_T], tqdm_auto[_T]):
class tqdm_telegram(tqdm_auto[_T], Generic[_T]):
tgio: Incomplete
@overload
def __init__(

View File

@@ -8,7 +8,7 @@ __all__ = ["tqdm_gui", "tgrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_gui(Generic[_T], std_tqdm[_T]):
class tqdm_gui(std_tqdm[_T], Generic[_T]):
mpl: Incomplete
plt: Incomplete
toolbar: Incomplete

View File

@@ -8,7 +8,7 @@ __all__ = ["tqdm_notebook", "tnrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_notebook(Generic[_T], std_tqdm[_T]):
class tqdm_notebook(std_tqdm[_T], Generic[_T]):
@staticmethod
def status_printer(
_: SupportsWrite[str] | None, total: float | None = None, desc: str | None = None, ncols: int | None = None

View File

@@ -33,7 +33,7 @@ class RateColumn(_ProgressColumn):
_T = TypeVar("_T")
class tqdm_rich(Generic[_T], std_tqdm[_T]):
class tqdm_rich(std_tqdm[_T], Generic[_T]):
def close(self) -> None: ...
def clear(self, *_, **__) -> None: ...
def display(self, *_, **__) -> None: ...

View File

@@ -31,7 +31,7 @@ class TqdmMonitorWarning(TqdmWarning, RuntimeWarning): ...
_T = TypeVar("_T")
class tqdm(Generic[_T], Iterable[_T], Comparable):
class tqdm(Iterable[_T], Comparable, Generic[_T]):
monitor_interval: ClassVar[int]
monitor: ClassVar[TMonitor | None]

View File

@@ -8,7 +8,7 @@ __all__ = ["tqdm_tk", "ttkrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_tk(Generic[_T], std_tqdm[_T]):
class tqdm_tk(std_tqdm[_T], Generic[_T]):
@overload
def __init__(
self,