Fix some errors with --disallow-any-generics (#3276)

See #3267. Covers all of stdlib/2and3.
This commit is contained in:
Guido van Rossum
2019-09-29 09:15:27 -07:00
committed by GitHub
parent 1e881ad156
commit b336182b69
27 changed files with 85 additions and 92 deletions

View File

@@ -49,7 +49,7 @@ class _mmap(Generic[AnyStr]):
def __len__(self) -> int: ...
if sys.version_info >= (3,):
class mmap(_mmap, ContextManager[mmap], Iterable[bytes], Sized):
class mmap(_mmap[bytes], ContextManager[mmap], Iterable[bytes], Sized):
closed: bool
def rfind(self, sub: bytes, start: int = ..., stop: int = ...) -> int: ...
@overload
@@ -65,7 +65,7 @@ if sys.version_info >= (3,):
# __len__, so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[bytes]: ...
else:
class mmap(_mmap, Sequence[bytes]):
class mmap(_mmap[bytes], Sequence[bytes]):
def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ...
def __getitem__(self, index: Union[int, slice]) -> bytes: ...
def __getslice__(self, i: Optional[int], j: Optional[int]) -> bytes: ...