Mypy now supports sys.platform and sys.version_info checks (#410)

This commit is contained in:
Guido van Rossum
2016-07-27 13:25:29 -07:00
committed by GitHub
parent 112a1a17dd
commit 39325bf159
27 changed files with 289 additions and 276 deletions

View File

@@ -52,11 +52,11 @@ class IOBase:
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
else:
def readline(self, limit: int = ...) -> bytes: ... # type: ignore
def readline(self, limit: int = ...) -> bytes: ...
if sys.version_info >= (3, 2):
closed = ... # type: bool
else:
def closed(self) -> bool: ... # type: ignore
def closed(self) -> bool: ...
class RawIOBase(IOBase):
def readall(self) -> bytes: ...
@@ -65,7 +65,7 @@ class RawIOBase(IOBase):
if sys.version_info >= (3, 4):
def read(self, size: int = ...) -> Optional[bytes]: ...
else:
def read(self, n: int = ...) -> Optional[bytes]: ... # type: ignore
def read(self, n: int = ...) -> Optional[bytes]: ...
class BufferedIOBase(IOBase):
def detach(self) -> RawIOBase: ...
@@ -77,8 +77,8 @@ class BufferedIOBase(IOBase):
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
else:
def read(self, n: Optional[int] = ...) -> bytes: ... # type: ignore
def read1(self, n: int = ...) -> bytes: ... # type: ignore
def read(self, n: Optional[int] = ...) -> bytes: ...
def read1(self, n: int = ...) -> bytes: ...
class FileIO(RawIOBase):
@@ -91,7 +91,7 @@ class FileIO(RawIOBase):
Callable[[Union[int, str], str], int]] = ...) \
-> None: ...
else:
def __init__(self, name: Union[str, bytes, int], # type: ignore
def __init__(self, name: Union[str, bytes, int],
mode: str = ..., closefd: bool = ...) -> None: ...
# TODO should extend from BufferedIOBase
@@ -124,11 +124,11 @@ class BytesIO(BinaryIO):
def readline(self, size: int = ...) -> bytes: ...
def __del__(self) -> None: ...
else:
def readline(self, limit: int = ...): ... # type: ignore
def readline(self, limit: int = ...): ...
if sys.version_info >= (3, 2):
closed = ... # type: bool
else:
def closed(self) -> bool: ... # type: ignore
def closed(self) -> bool: ...
# copied from BufferedIOBase
def detach(self) -> RawIOBase: ...
def readinto(self, b: bytearray) -> int: ...
@@ -139,15 +139,15 @@ class BytesIO(BinaryIO):
def read(self, size: Optional[int] = ...) -> bytes: ...
def read1(self, size: int = ...) -> bytes: ...
else:
def read(self, n: Optional[int] = ...) -> bytes: ... # type: ignore
def read1(self, n: int = ...) -> bytes: ... # type: ignore
def read(self, n: Optional[int] = ...) -> bytes: ...
def read1(self, n: 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: ... # type: ignore
def peek(self, n: int = ...) -> bytes: ...
class BufferedWriter(BufferedIOBase):
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
@@ -179,7 +179,7 @@ class TextIOBase(IOBase):
elif sys.version_info >= (3, 2):
def readline(self, limit: int = ...) -> str: ... # type: ignore
else:
def readline(self) -> str: ... # type: ignore
def readline(self) -> str: ...
if sys.version_info >= (3, 2):
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
@@ -194,7 +194,7 @@ class TextIOWrapper(TextIO):
# line_buffering: bool = ..., write_through: bool = ...) \
# -> None: ...
#else:
# def __init__(self, buffer: IO[bytes], # type: ignore
# def __init__(self, buffer: IO[bytes],
# encoding: str = ..., errors: Optional[str] = ...,
# newline: Optional[str] = ..., line_buffering: bool = ...) \
# -> None: ...
@@ -222,23 +222,23 @@ class TextIOWrapper(TextIO):
if sys.version_info >= (3, 2):
closed = ... # type: bool
else:
def closed(self) -> bool: ... # type: ignore
def closed(self) -> bool: ...
# copied from TextIOBase
encoding = ... # type: str
errors = ... # type: Optional[str]
newlines = ... # type: Union[str, Tuple[str, ...], None]
def __iter__(self) -> Iterator[str]: ... # type: ignore
def __next__(self) -> str: ... # type: ignore
def __iter__(self) -> Iterator[str]: ...
def __next__(self) -> str: ...
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: ... # type: ignore
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: ... # type: ignore
def readline(self, limit: int = ...) -> str: ...
else:
def readline(self) -> str: ... # type: ignore
def readline(self) -> str: ...
if sys.version_info >= (3, 2):
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...