Improve Self type usage accross stdlib (#7183)

This commit is contained in:
Nikita Sobolev
2022-02-13 14:21:01 +03:00
committed by GitHub
parent 03dbe2206c
commit 6882e513c2
2 changed files with 8 additions and 10 deletions

View File

@@ -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]: ...