11import io
22import sys
33from os .path import _PathType
4- from typing import IO , Any , Mapping , Optional , Sequence , TextIO , Union , overload
4+ from typing import IO , Any , Mapping , Optional , Sequence , TextIO , TypeVar , Union , overload
55
66if sys .version_info >= (3 , 8 ):
77 from typing import Literal
@@ -14,6 +14,7 @@ _OpenTextWritingMode = Literal["wt", "xt", "at"]
1414_PathOrFile = Union [_PathType , IO [bytes ]]
1515
1616_FilterChain = Sequence [Mapping [str , Any ]]
17+ _T = TypeVar ("_T" )
1718
1819FORMAT_AUTO : int
1920FORMAT_XZ : int
@@ -69,7 +70,7 @@ class LZMACompressor(object):
6970
7071class LZMAError (Exception ): ...
7172
72- class LZMAFile (io .BufferedIOBase , IO [bytes ]): # type: ignore # python/mypy#5027
73+ class LZMAFile (io .BufferedIOBase , IO [bytes ]):
7374 def __init__ (
7475 self ,
7576 filename : Optional [_PathOrFile ] = ...,
@@ -80,6 +81,7 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#502
8081 preset : Optional [int ] = ...,
8182 filters : Optional [_FilterChain ] = ...,
8283 ) -> None : ...
84+ def __enter__ (self : _T ) -> _T : ...
8385 def close (self ) -> None : ...
8486 @property
8587 def closed (self ) -> bool : ...
0 commit comments