mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Improve Self type usage accross stdlib (#7183)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from concurrent.futures._base import Error, Future as _ConcurrentFuture
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, TypeVar
|
||||
|
||||
@@ -16,7 +17,6 @@ if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S")
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
class _TracebackLogger:
|
||||
@@ -39,12 +39,12 @@ class Future(Awaitable[_T], Iterable[_T]):
|
||||
def __del__(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def _callbacks(self: _S) -> list[tuple[Callable[[_S], Any], Context]]: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ...
|
||||
def _callbacks(self: Self) -> list[tuple[Callable[[Self], Any], Context]]: ...
|
||||
def add_done_callback(self: Self, __fn: Callable[[Self], Any], *, context: Context | None = ...) -> None: ...
|
||||
else:
|
||||
@property
|
||||
def _callbacks(self: _S) -> list[Callable[[_S], Any]]: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
|
||||
def _callbacks(self: Self) -> list[Callable[[Self], Any]]: ...
|
||||
def add_done_callback(self: Self, __fn: Callable[[Self], Any]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def cancel(self, msg: Any | None = ...) -> bool: ...
|
||||
else:
|
||||
@@ -54,7 +54,7 @@ class Future(Awaitable[_T], Iterable[_T]):
|
||||
def done(self) -> bool: ...
|
||||
def result(self) -> _T: ...
|
||||
def exception(self) -> BaseException | None: ...
|
||||
def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ...
|
||||
def remove_done_callback(self: Self, __fn: Callable[[Self], Any]) -> int: ...
|
||||
def set_result(self, __result: _T) -> None: ...
|
||||
def set_exception(self, __exception: type | BaseException) -> None: ...
|
||||
def __iter__(self) -> Generator[Any, None, _T]: ...
|
||||
|
||||
Reference in New Issue
Block a user