Fix a few TODOs (#1487)

* fix some easy TODOs

* fix io
This commit is contained in:
Jelle Zijlstra
2017-07-19 10:27:50 -07:00
committed by Łukasz Langa
parent 1515ed9f88
commit ac651d2f8c
4 changed files with 25 additions and 50 deletions

View File

@@ -16,19 +16,13 @@ SEEK_END = ... # type: int
open = builtins.open
# FIXME when mypy handle condtional, we can uncomment the next block and remove
# the temporary fix
# if sys.version_info >= (3, 3):
# BlockingIOError = BlockingIOError
# class UnsupportedOperation(OSError, ValueError): ...
# else:
# class BlockingIOError(IOError):
# characters_written = ... # type: int
# class UnsupportedOperation(IOError, ValueError): ...
class BlockingIOError(OSError):
characters_written = ... # type: int
class UnsupportedOperation(OSError, ValueError): ...
if sys.version_info >= (3, 3):
BlockingIOError = builtins.BlockingIOError
class UnsupportedOperation(OSError, ValueError): ...
else:
class BlockingIOError(IOError):
characters_written: int
class UnsupportedOperation(IOError, ValueError): ...
class IOBase:
def __iter__(self) -> Iterator[bytes]: ...

View File

@@ -116,9 +116,8 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
def send(self, value: _T_contra) -> _T_co: ...
@abstractmethod
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = None,
# TODO: tb should be TracebackType but that's defined in types
tb: Any = None) -> None: ...
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
tb: Optional[TracebackType] = ...) -> None: ...
@abstractmethod
def close(self) -> None: ...
@@ -144,9 +143,8 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
def send(self, value: _T_contra) -> _T_co: ...
@abstractmethod
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = None,
# TODO: tb should be TracebackType but that's defined in types
tb: Any = None) -> None: ...
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
tb: Optional[TracebackType] = ...) -> None: ...
@abstractmethod
def close(self) -> None: ...
@@ -399,8 +397,7 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
def __enter__(self) -> 'IO[AnyStr]': ...
@abstractmethod
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
# TODO: traceback should be TracebackType but that's defined in types
traceback: Optional[Any]) -> bool: ...
traceback: Optional[TracebackType]) -> bool: ...
class BinaryIO(IO[bytes]):
# TODO readinto

View File

@@ -16,10 +16,9 @@ _E = TypeVar('_E', bound=Exception)
def expectedFailure(func: _FT) -> _FT: ...
# TODO: Once python/mypy#1551 is fixed, the following need _FT instead of Any
def skip(reason: str) -> Callable[[Any], Any]: ...
def skipIf(condition: object, reason: str) -> Callable[[Any], Any]: ...
def skipUnless(condition: object, reason: str) -> Callable[[Any], Any]: ...
def skip(reason: str) -> Callable[[_FT], _FT]: ...
def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: ...
def skipUnless(condition: object, reason: str) -> Callable[[_FT], _FT]: ...
class SkipTest(Exception):
def __init__(self, reason: str) -> None: ...