Use _typeshed.Self with __enter__ (#5717)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Anton Grübel
2021-07-01 12:32:32 +02:00
committed by GitHub
parent 04f0113d16
commit 96e0660fba
12 changed files with 44 additions and 39 deletions

View File

@@ -1,6 +1,6 @@
import io
from _typeshed import ReadableBuffer, StrOrBytesPath
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload
from _typeshed import ReadableBuffer, Self, StrOrBytesPath
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, Union, overload
from typing_extensions import Literal
_OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"]
@@ -9,7 +9,6 @@ _OpenTextWritingMode = Literal["wt", "xt", "at"]
_PathOrFile = Union[StrOrBytesPath, IO[bytes]]
_FilterChain = Sequence[Mapping[str, Any]]
_T = TypeVar("_T")
FORMAT_AUTO: int
FORMAT_XZ: int
@@ -76,7 +75,7 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]):
preset: Optional[int] = ...,
filters: Optional[_FilterChain] = ...,
) -> None: ...
def __enter__(self: _T) -> _T: ...
def __enter__(self: Self) -> Self: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...