Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,16 +1,15 @@
import io
from _typeshed import ReadableBuffer, WriteableBuffer
from typing import IO, Any, Iterable, List, Text, TypeVar, Union
from _typeshed import ReadableBuffer, Self, WriteableBuffer
from typing import IO, Any, Iterable, List, Text, Union
from typing_extensions import SupportsIndex
_PathOrFile = Union[Text, IO[bytes]]
_T = TypeVar("_T")
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
def decompress(data: bytes) -> bytes: ...
class BZ2File(io.BufferedIOBase, IO[bytes]):
def __enter__(self: _T) -> _T: ...
def __enter__(self: Self) -> Self: ...
def __init__(self, filename: _PathOrFile, mode: str = ..., buffering: Any | None = ..., compresslevel: int = ...) -> None: ...
def read(self, size: int | None = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...