1
1
import io
2
2
import sys
3
3
from 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
5
5
6
6
if sys .version_info >= (3 , 8 ):
7
7
from typing import Literal
@@ -14,6 +14,7 @@ _OpenTextWritingMode = Literal["wt", "xt", "at"]
14
14
_PathOrFile = Union [_PathType , IO [bytes ]]
15
15
16
16
_FilterChain = Sequence [Mapping [str , Any ]]
17
+ _T = TypeVar ("_T" )
17
18
18
19
FORMAT_AUTO : int
19
20
FORMAT_XZ : int
@@ -69,7 +70,7 @@ class LZMACompressor(object):
69
70
70
71
class LZMAError (Exception ): ...
71
72
72
- class LZMAFile (io .BufferedIOBase , IO [bytes ]): # type: ignore # python/mypy#5027
73
+ class LZMAFile (io .BufferedIOBase , IO [bytes ]):
73
74
def __init__ (
74
75
self ,
75
76
filename : Optional [_PathOrFile ] = ...,
@@ -80,6 +81,7 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#502
80
81
preset : Optional [int ] = ...,
81
82
filters : Optional [_FilterChain ] = ...,
82
83
) -> None : ...
84
+ def __enter__ (self : _T ) -> _T : ...
83
85
def close (self ) -> None : ...
84
86
@property
85
87
def closed (self ) -> bool : ...
0 commit comments