Drop Python 3.3 support from several stubs (#2266)

* Drop Python 3.3 support from importlib stubs

* Drop Python 3.3 support from html and symbol stubs
This commit is contained in:
Sebastian Rittau
2018-06-21 01:46:11 +02:00
committed by Jelle Zijlstra
parent 1184726417
commit b05e99297c
16 changed files with 140 additions and 246 deletions

View File

@@ -20,13 +20,8 @@ _T = TypeVar('_T', bound='IOBase')
open = builtins.open
if sys.version_info >= (3, 3):
BlockingIOError = builtins.BlockingIOError
class UnsupportedOperation(OSError, ValueError): ...
else:
class BlockingIOError(IOError):
characters_written: int
class UnsupportedOperation(IOError, ValueError): ...
BlockingIOError = builtins.BlockingIOError
class UnsupportedOperation(OSError, ValueError): ...
class IOBase:
def __iter__(self) -> Iterator[bytes]: ...
@@ -46,25 +41,16 @@ class IOBase:
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def writelines(self, lines: Iterable[Union[bytes, bytearray]]) -> None: ...
if sys.version_info >= (3, 4):
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
else:
def readline(self, limit: int = ...) -> bytes: ...
if sys.version_info >= (3, 2):
@property
def closed(self) -> bool: ...
else:
def closed(self) -> bool: ...
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
@property
def closed(self) -> bool: ...
class RawIOBase(IOBase):
def readall(self) -> bytes: ...
def readinto(self, b: bytearray) -> Optional[int]: ...
def write(self, b: Union[bytes, bytearray]) -> Optional[int]: ...
if sys.version_info >= (3, 4):
def read(self, size: int = ...) -> Optional[bytes]: ...
else:
def read(self, n: int = ...) -> Optional[bytes]: ...
def read(self, size: int = ...) -> Optional[bytes]: ...
class BufferedIOBase(IOBase):
def detach(self) -> RawIOBase: ...
@@ -72,28 +58,20 @@ class BufferedIOBase(IOBase):
def write(self, b: Union[bytes, bytearray]) -> int: ...
if sys.version_info >= (3, 5):
def readinto1(self, b: _bytearray_like) -> int: ...
if sys.version_info >= (3, 4):
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
else:
def read(self, n: Optional[int] = ...) -> bytes: ...
def read1(self, n: int = ...) -> bytes: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
class FileIO(RawIOBase):
mode = ... # type: str
name = ... # type: Union[int, str]
if sys.version_info >= (3, 3):
def __init__(
self,
name: Union[str, bytes, int],
mode: str = ...,
closefd: bool = ...,
opener: Optional[Callable[[Union[int, str], str], int]] = ...
) -> None: ...
else:
def __init__(self, name: Union[str, bytes, int],
mode: str = ..., closefd: bool = ...) -> None: ...
def __init__(
self,
name: Union[str, bytes, int],
mode: str = ...,
closefd: bool = ...,
opener: Optional[Callable[[Union[int, str], str], int]] = ...
) -> None: ...
# TODO should extend from BufferedIOBase
class BytesIO(BinaryIO):
@@ -103,8 +81,7 @@ class BytesIO(BinaryIO):
# as a read-only property on IO[].
name: Any
def getvalue(self) -> bytes: ...
if sys.version_info >= (3, 2):
def getbuffer(self) -> memoryview: ...
def getbuffer(self) -> memoryview: ...
# copied from IOBase
def __iter__(self) -> Iterator[bytes]: ...
def __next__(self) -> bytes: ...
@@ -125,34 +102,21 @@ class BytesIO(BinaryIO):
# TODO should be the next line instead
# def writelines(self, lines: List[Union[bytes, bytearray]]) -> None: ...
def writelines(self, lines: Any) -> None: ...
if sys.version_info >= (3, 4):
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
else:
def readline(self, limit: int = ...): ...
if sys.version_info >= (3, 2):
closed = ... # type: bool
else:
def closed(self) -> bool: ...
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
closed = ... # type: bool
# copied from BufferedIOBase
def detach(self) -> RawIOBase: ...
def readinto(self, b: _bytearray_like) -> int: ...
def write(self, b: Union[bytes, bytearray]) -> int: ...
if sys.version_info >= (3, 5):
def readinto1(self, b: _bytearray_like) -> int: ...
if sys.version_info >= (3, 4):
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
else:
def read(self, n: Optional[int] = ...) -> bytes: ...
def read1(self, n: int = ...) -> bytes: ...
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
class BufferedReader(BufferedIOBase):
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
if sys.version_info >= (3, 4):
def peek(self, size: int = ...) -> bytes: ...
else:
def peek(self, n: int = ...) -> bytes: ...
def peek(self, size: int = ...) -> bytes: ...
class BufferedWriter(BufferedIOBase):
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
@@ -177,31 +141,19 @@ class TextIOBase(IOBase):
def __next__(self) -> str: ... # type: ignore
def detach(self) -> IOBase: ...
def write(self, s: str) -> int: ...
if sys.version_info >= (3, 4):
def readline(self, size: int = ...) -> str: ... # type: ignore
def read(self, size: Optional[int] = ...) -> str: ...
elif sys.version_info >= (3, 2):
def readline(self, limit: int = ...) -> str: ... # type: ignore
else:
def readline(self) -> str: ...
if sys.version_info >= (3, 2):
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def readline(self, size: int = ...) -> str: ... # type: ignore
def read(self, size: Optional[int] = ...) -> str: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
# TODO should extend from TextIOBase
class TextIOWrapper(TextIO):
line_buffering = ... # type: bool
# TODO uncomment after fixing mypy about using write_through
# if sys.version_info >= (3, 3):
# def __init__(self, buffer: IO[bytes], encoding: str = ...,
# errors: Optional[str] = ..., newline: Optional[str] = ...,
# line_buffering: bool = ..., write_through: bool = ...) \
# -> None: ...
# else:
# def __init__(self, buffer: IO[bytes],
# encoding: str = ..., errors: Optional[str] = ...,
# newline: Optional[str] = ..., line_buffering: bool = ...) \
# -> None: ...
# def __init__(self, buffer: IO[bytes], encoding: str = ...,
# errors: Optional[str] = ..., newline: Optional[str] = ...,
# line_buffering: bool = ..., write_through: bool = ...) \
# -> None: ...
def __init__(
self,
buffer: IO[bytes],
@@ -226,12 +178,8 @@ class TextIOWrapper(TextIO):
# TODO should be the next line instead
# def writelines(self, lines: List[str]) -> None: ...
def writelines(self, lines: Any) -> None: ...
if sys.version_info >= (3, 4):
def __del__(self) -> None: ...
if sys.version_info >= (3, 2):
closed = ... # type: bool
else:
def closed(self) -> bool: ...
def __del__(self) -> None: ...
closed = ... # type: bool
# copied from TextIOBase
encoding = ... # type: str
errors = ... # type: Optional[str]
@@ -241,17 +189,10 @@ class TextIOWrapper(TextIO):
def __enter__(self) -> 'TextIO': ...
def detach(self) -> IOBase: ...
def write(self, s: str) -> int: ...
if sys.version_info >= (3, 4):
def readline(self, size: int = ...) -> str: ...
def read(self, size: Optional[int] = ...) -> str: ...
elif sys.version_info >= (3, 2):
def readline(self, limit: int = ...) -> str: ...
def read(self, size: Optional[int] = ...) -> str: ...
else:
def readline(self) -> str: ...
if sys.version_info >= (3, 2):
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def readline(self, size: int = ...) -> str: ...
def read(self, size: Optional[int] = ...) -> str: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
class StringIO(TextIOWrapper):
def __init__(self, initial_value: str = ...,