Use _typeshed.Self where __enter__ returns self (#5698)

This commit is contained in:
Dominic Davis-Foster
2021-06-27 20:58:58 +01:00
committed by GitHub
parent 1fb100dca4
commit 58559e56b3
7 changed files with 16 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import Self
from types import TracebackType
from typing import IO, Any, List, NamedTuple, Optional, Tuple, Type, Union, overload
from typing_extensions import Literal
@@ -18,7 +19,7 @@ _Marker = Tuple[int, int, bytes]
class Aifc_read:
def __init__(self, f: _File) -> None: ...
def __enter__(self) -> Aifc_read: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
@@ -42,7 +43,7 @@ class Aifc_read:
class Aifc_write:
def __init__(self, f: _File) -> None: ...
def __del__(self) -> None: ...
def __enter__(self) -> Aifc_write: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...