Use typing_extensions.Self instead of _typeshed.Self (#9702)

This commit is contained in:
Alex Waygood
2023-02-15 11:32:43 +01:00
committed by GitHub
parent 8cd6d81f15
commit 7180d0223b
140 changed files with 597 additions and 610 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
from _typeshed import Incomplete, Self, SupportsWrite
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing_extensions import Self
from .std import tqdm as std_tqdm
@@ -13,7 +14,7 @@ class tqdm_asyncio(Generic[_T], std_tqdm[_T]):
iterable_next: Callable[[], _T | Awaitable[_T]]
iterable_iterator: Iterator[_T]
def __aiter__(self: Self) -> Self: ...
def __aiter__(self) -> Self: ...
async def __anext__(self) -> Awaitable[_T]: ...
def send(self, *args, **kwargs): ...
@classmethod
+3 -2
View File
@@ -1,6 +1,7 @@
from _typeshed import Incomplete, Self
from _typeshed import Incomplete
from collections.abc import Callable
from typing import ClassVar
from typing_extensions import Self
__all__ = ["TqdmCallback"]
@@ -15,7 +16,7 @@ class _Callback:
posttask: Incomplete | None,
finish: Incomplete | None,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args) -> None: ...
def register(self) -> None: ...
def unregister(self) -> None: ...
+4 -4
View File
@@ -1,8 +1,8 @@
import contextlib
from _typeshed import Incomplete, Self, SupportsWrite
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping
from typing import Any, ClassVar, Generic, NoReturn, TypeVar, overload
from typing_extensions import Literal
from typing_extensions import Literal, Self
from ._monitor import TMonitor
from .utils import Comparable
@@ -121,7 +121,7 @@ class tqdm(Generic[_T], Iterable[_T], Comparable):
gui: bool = ...,
**kwargs,
) -> None: ...
def __new__(cls: type[Self], *_, **__) -> Self: ...
def __new__(cls, *_, **__) -> Self: ...
@classmethod
def write(cls, s: str, file: SupportsWrite[str] | None = ..., end: str = ..., nolock: bool = ...) -> None: ...
@classmethod
@@ -199,7 +199,7 @@ class tqdm(Generic[_T], Iterable[_T], Comparable):
def __len__(self) -> int: ...
def __reversed__(self) -> Iterator[_T]: ...
def __contains__(self, item: object) -> bool: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
def __del__(self) -> None: ...
def __hash__(self) -> int: ...