Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions stdlib/2and3/bz2.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import io
import sys
from os.path import _PathType
from typing import IO, Any, Optional, TextIO, Union, overload
from typing import IO, Any, Optional, TextIO, Union, overload, TypeVar

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

_PathOrFile = Union[_PathType, IO[bytes]]
_T = TypeVar("_T")

def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
Expand Down Expand Up @@ -44,7 +45,8 @@ if sys.version_info >= (3, 3):
newline: Optional[str] = ...,
) -> Union[BZ2File, TextIO]: ...

class BZ2File(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
if sys.version_info >= (3, 9):
def __init__(self,
filename: _PathOrFile,
Expand Down
6 changes: 4 additions & 2 deletions stdlib/3/lzma.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io
import sys
from os.path import _PathType
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, Union, overload
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload

if sys.version_info >= (3, 8):
from typing import Literal
Expand All @@ -14,6 +14,7 @@ _OpenTextWritingMode = Literal["wt", "xt", "at"]
_PathOrFile = Union[_PathType, IO[bytes]]

_FilterChain = Sequence[Mapping[str, Any]]
_T = TypeVar("_T")

FORMAT_AUTO: int
FORMAT_XZ: int
Expand Down Expand Up @@ -69,7 +70,7 @@ class LZMACompressor(object):

class LZMAError(Exception): ...

class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027
class LZMAFile(io.BufferedIOBase, IO[bytes]):
def __init__(
self,
filename: Optional[_PathOrFile] = ...,
Expand All @@ -80,6 +81,7 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#502
preset: Optional[int] = ...,
filters: Optional[_FilterChain] = ...,
) -> None: ...
def __enter__(self: _T) -> _T: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
Expand Down