Skip to content

Commit

Permalink
Mark stub-only types with an underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
srittau committed Aug 17, 2018
1 parent 873db9f commit d716634
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions stdlib/2/sys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ from typing import (
from types import FrameType, ModuleType, TracebackType, ClassType

# The following type alias are stub-only and do not exist during runtime
ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
_OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]

class _flags:
bytes_warning = ... # type: int
Expand Down Expand Up @@ -117,7 +117,7 @@ def __excepthook__(type_: type, value: BaseException, traceback: TracebackType)
def exc_clear() -> None:
raise DeprecationWarning()
# TODO should be a union of tuple, see mypy#1178
def exc_info() -> OptExcInfo: ...
def exc_info() -> _OptExcInfo: ...

# sys.exit() accepts an optional argument of anything printable
def exit(arg: Any = ...) -> NoReturn:
Expand Down
4 changes: 2 additions & 2 deletions stdlib/2and3/wsgiref/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# you need to use 'WSGIApplication' and not simply WSGIApplication when type
# hinting your code. Otherwise Python will raise NameErrors.

from sys import OptExcInfo
from sys import _OptExcInfo
from typing import Callable, Dict, Iterable, List, Any, Text, Protocol, Tuple, Optional

class StartResponse(Protocol):
def __call__(self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[OptExcInfo] = ...) -> Callable[[bytes], Any]: ...
def __call__(self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[_OptExcInfo] = ...) -> Callable[[bytes], Any]: ...

WSGIEnvironment = Dict[Text, Any]
WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]
Expand Down
6 changes: 3 additions & 3 deletions stdlib/3/sys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ from importlib.abc import MetaPathFinder
_T = TypeVar('_T')

# The following type alias are stub-only and do not exist during runtime
ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
_OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]

# ----- sys variables -----
abiflags: str
Expand Down Expand Up @@ -132,7 +132,7 @@ def _current_frames() -> Dict[int, Any]: ...
def displayhook(value: Optional[int]) -> None: ...
def excepthook(type_: Type[BaseException], value: BaseException,
traceback: TracebackType) -> None: ...
def exc_info() -> OptExcInfo: ...
def exc_info() -> _OptExcInfo: ...
# sys.exit() accepts an optional argument of anything printable
def exit(arg: object = ...) -> NoReturn:
raise SystemExit()
Expand Down

0 comments on commit d716634

Please sign in to comment.