Add NoReturn (#811)

* Add NoReturn
This commit is contained in:
David Fisher
2017-01-04 13:38:05 -08:00
committed by Łukasz Langa
parent 93bb4604cb
commit 2cb8e184cc
9 changed files with 22 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ from typing import (
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container,
)
from abc import abstractmethod, ABCMeta
from mypy_extensions import NoReturn
_T = TypeVar('_T')
_T_co = TypeVar('_T_co', covariant=True)
@@ -682,7 +683,7 @@ def dir(o: object = ...) -> List[str]: ...
def divmod(a: int, b: int) -> Tuple[int, int]: ...
@overload
def divmod(a: float, b: float) -> Tuple[float, float]: ...
def exit(code: int = ...) -> None: ...
def exit(code: int = ...) -> NoReturn: ...
@overload
def filter(function: Callable[[_T], Any],
iterable: Iterable[_T]) -> List[_T]: ...

View File

@@ -5,6 +5,7 @@ from typing import (
Dict, MutableMapping, NamedTuple, overload
)
from . import path
from mypy_extensions import NoReturn
error = OSError
name = ... # type: str
@@ -185,7 +186,7 @@ def execvpe(file: AnyStr, args: Union[Tuple[AnyStr], List[AnyStr]], env: Mapping
def execv(path: AnyStr, args: Union[Tuple[AnyStr], List[AnyStr]]) -> None: ...
def execve(path: AnyStr, args: Union[Tuple[AnyStr], List[AnyStr]], env: Mapping[AnyStr, AnyStr]) -> None: ...
def _exit(n: int) -> None: ...
def _exit(n: int) -> NoReturn: ...
def fork() -> int: ...
def forkpty() -> Tuple[int, int]: ...

View File

@@ -5,6 +5,7 @@ from typing import (
overload, Type,
)
from types import FrameType, ModuleType, TracebackType, ClassType
from mypy_extensions import NoReturn
class _flags:
bytes_warning = ... # type: int
@@ -118,7 +119,7 @@ def exc_info() -> Tuple[Optional[Type[BaseException]],
Optional[TracebackType]]: ...
# sys.exit() accepts an optional argument of anything printable
def exit(arg: Any = ...) -> None:
def exit(arg: Any = ...) -> NoReturn:
raise SystemExit()
def getcheckinterval() -> int: ... # deprecated
def getdefaultencoding() -> str: ...