mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-07 10:20:58 +08:00
Fix type hint of generator throw method (#4253)
* Fix type hint of generator throw method * Incorporated changes from #4252
This commit is contained in:
@@ -167,11 +167,16 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def send(self, value: _T_contra) -> _T_co: ...
|
||||
def send(self, __value: _T_contra) -> _T_co: ...
|
||||
|
||||
@overload
|
||||
@abstractmethod
|
||||
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
def throw(self, __typ: Type[BaseException], __val: Union[BaseException, object] = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def throw(self, __typ: BaseException, __val: None = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@@ -204,11 +209,16 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
def cr_running(self) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
def send(self, value: _T_contra) -> _T_co: ...
|
||||
def send(self, __value: _T_contra) -> _T_co: ...
|
||||
|
||||
@overload
|
||||
@abstractmethod
|
||||
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
def throw(self, __typ: Type[BaseException], __val: Union[BaseException, object] = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def throw(self, __typ: BaseException, __val: None = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@@ -237,11 +247,16 @@ if sys.version_info >= (3, 6):
|
||||
def __anext__(self) -> Awaitable[_T_co]: ...
|
||||
|
||||
@abstractmethod
|
||||
def asend(self, value: _T_contra) -> Awaitable[_T_co]: ...
|
||||
def asend(self, __value: _T_contra) -> Awaitable[_T_co]: ...
|
||||
|
||||
@overload
|
||||
@abstractmethod
|
||||
def athrow(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
|
||||
tb: Any = ...) -> Awaitable[_T_co]: ...
|
||||
def athrow(self, __typ: Type[BaseException], __val: Union[BaseException, object] = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> Awaitable[_T_co]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def athrow(self, __typ: BaseException, __val: None = ...,
|
||||
__tb: Optional[TracebackType] = ...) -> Awaitable[_T_co]: ...
|
||||
|
||||
@abstractmethod
|
||||
def aclose(self) -> Awaitable[None]: ...
|
||||
|
||||
Reference in New Issue
Block a user