Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)

* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
Akuli
2021-05-15 15:33:39 +03:00
committed by GitHub
parent b0ef85288d
commit 17dcea4a68
106 changed files with 1539 additions and 3275 deletions

View File

@@ -2,8 +2,7 @@ import sys
from typing import IO, Any, Callable, Iterable, Iterator, Mapping, Optional, Tuple, Type, Union
HIGHEST_PROTOCOL: int
if sys.version_info >= (3, 0):
DEFAULT_PROTOCOL: int
DEFAULT_PROTOCOL: int
bytes_types: Tuple[Type[Any], ...] # undocumented
@@ -38,18 +37,12 @@ if sys.version_info >= (3, 8):
__data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ..., buffers: Optional[Iterable[Any]] = ...
) -> Any: ...
elif sys.version_info >= (3, 0):
else:
def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
def dumps(obj: Any, protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> bytes: ...
def load(file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
def loads(data: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ...
else:
def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ...) -> None: ...
def dumps(obj: Any, protocol: Optional[int] = ...) -> bytes: ...
def load(file: IO[bytes]) -> Any: ...
def loads(string: bytes) -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...
@@ -64,8 +57,7 @@ _reducedtype = Union[
class Pickler:
fast: bool
if sys.version_info >= (3, 3):
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
if sys.version_info >= (3, 8):
def __init__(
@@ -77,10 +69,8 @@ class Pickler:
buffer_callback: _BufferCallback = ...,
) -> None: ...
def reducer_override(self, obj: Any) -> Any: ...
elif sys.version_info >= (3, 0):
def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
else:
def __init__(self, file: IO[bytes], protocol: Optional[int] = ...) -> None: ...
def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ...
def dump(self, __obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
@@ -96,14 +86,11 @@ class Unpickler:
errors: str = ...,
buffers: Optional[Iterable[Any]] = ...,
) -> None: ...
elif sys.version_info >= (3, 0):
def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> None: ...
else:
def __init__(self, file: IO[bytes]) -> None: ...
def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> None: ...
def load(self) -> Any: ...
def find_class(self, __module_name: str, __global_name: str) -> Any: ...
if sys.version_info >= (3, 0):
def persistent_load(self, pid: Any) -> Any: ...
def persistent_load(self, pid: Any) -> Any: ...
MARK: bytes
STOP: bytes
@@ -164,23 +151,21 @@ NEWFALSE: bytes
LONG1: bytes
LONG4: bytes
if sys.version_info >= (3, 0):
# protocol 3
BINBYTES: bytes
SHORT_BINBYTES: bytes
# protocol 3
BINBYTES: bytes
SHORT_BINBYTES: bytes
if sys.version_info >= (3, 4):
# protocol 4
SHORT_BINUNICODE: bytes
BINUNICODE8: bytes
BINBYTES8: bytes
EMPTY_SET: bytes
ADDITEMS: bytes
FROZENSET: bytes
NEWOBJ_EX: bytes
STACK_GLOBAL: bytes
MEMOIZE: bytes
FRAME: bytes
# protocol 4
SHORT_BINUNICODE: bytes
BINUNICODE8: bytes
BINBYTES8: bytes
EMPTY_SET: bytes
ADDITEMS: bytes
FROZENSET: bytes
NEWOBJ_EX: bytes
STACK_GLOBAL: bytes
MEMOIZE: bytes
FRAME: bytes
def encode_long(x: int) -> bytes: ... # undocumented
def decode_long(data: bytes) -> int: ... # undocumented