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

@@ -1,6 +1,6 @@
import sys
from _typeshed import ReadableBuffer
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload
from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sized, Union, overload
ACCESS_DEFAULT: int
ACCESS_READ: int
@@ -48,41 +48,26 @@ class _mmap(Generic[AnyStr]):
def write_byte(self, byte: AnyStr) -> None: ...
def __len__(self) -> int: ...
if sys.version_info >= (3,):
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
closed: bool
if sys.version_info >= (3, 8) and sys.platform != "win32":
def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ...
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def read(self, n: Optional[int] = ...) -> bytes: ...
if sys.version_info >= (3, 6):
def write(self, bytes: ReadableBuffer) -> int: ...
else:
def write(self, bytes: ReadableBuffer) -> None: ...
@overload
def __getitem__(self, index: int) -> int: ...
@overload
def __getitem__(self, index: slice) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
@overload
def __setitem__(self, index: int, object: int) -> None: ...
@overload
def __setitem__(self, index: slice, object: bytes) -> None: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
# __len__, so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[bytes]: ...
else:
class mmap(_mmap[bytes], Sequence[bytes]):
def find(self, string: bytes, start: int = ..., end: int = ...) -> int: ...
def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ...
def read(self, num: int) -> bytes: ...
def write(self, string: bytes) -> None: ...
def __getitem__(self, index: Union[int, slice]) -> bytes: ...
def __getslice__(self, i: Optional[int], j: Optional[int]) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def __setitem__(self, index: Union[int, slice], object: bytes) -> None: ...
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
closed: bool
if sys.version_info >= (3, 8) and sys.platform != "win32":
def madvise(self, option: int, start: int = ..., length: int = ...) -> None: ...
def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ...
def read(self, n: Optional[int] = ...) -> bytes: ...
def write(self, bytes: ReadableBuffer) -> int: ...
@overload
def __getitem__(self, index: int) -> int: ...
@overload
def __getitem__(self, index: slice) -> bytes: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
@overload
def __setitem__(self, index: int, object: int) -> None: ...
@overload
def __setitem__(self, index: slice, object: bytes) -> None: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
# __len__, so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[bytes]: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int