--- /dev/null
+# Stubs for traceback\r
+\r
+from typing import Any, Dict, Generator, IO, Iterator, List, Mapping, Optional, Tuple, Type, Iterable\r
+from types import FrameType, TracebackType\r
+import sys\r
+\r
+_PT = Tuple[str, int, str, Optional[str]]\r
+\r
+\r
+def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...) -> None: ...\r
+if sys.version_info >= (3,):\r
+ def print_exception(etype: Optional[Type[BaseException]],\r
+ value: Optional[BaseException],\r
+ tb: Optional[TracebackType], limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...,\r
+ chain: bool = ...) -> None: ...\r
+ def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ...,\r
+ chain: bool = ...) -> None: ...\r
+ def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ...,\r
+ chain: bool = ...) -> None: ...\r
+else:\r
+ def print_exception(etype: Optional[Type[BaseException]],\r
+ value: Optional[BaseException],\r
+ tb: Optional[TracebackType], limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...) -> None: ...\r
+ def print_exc(limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...) -> None: ...\r
+ def print_last(limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...) -> None: ...\r
+def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...,\r
+ file: Optional[IO[str]] = ...) -> None: ...\r
+\r
+if sys.version_info >= (3, 5):\r
+ def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...\r
+ def extract_stack(f: Optional[FrameType] = ...,\r
+ limit: Optional[int] = ...) -> StackSummary: ...\r
+ def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...\r
+else:\r
+ def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ...\r
+ def extract_stack(f: Optional[FrameType] = ...,\r
+ limit: Optional[int] = ...) -> List[_PT]: ...\r
+ def format_list(extracted_list: List[_PT]) -> List[str]: ...\r
+def format_exception_only(etype: Optional[Type[BaseException]],\r
+ value: Optional[BaseException]) -> List[str]: ...\r
+if sys.version_info >= (3,):\r
+ def format_exception(etype: Optional[Type[BaseException]], value: Optional[BaseException],\r
+ tb: Optional[TracebackType], limit: Optional[int] = ...,\r
+ chain: bool = ...) -> List[str]: ...\r
+ def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ...\r
+else:\r
+ def format_exception(etype: Optional[Type[BaseException]],\r
+ value: Optional[BaseException],\r
+ tb: Optional[TracebackType],\r
+ limit: Optional[int] = ...) -> List[str]: ...\r
+ def format_exc(limit: Optional[int] = ...) -> str: ...\r
+def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ...\r
+def format_stack(f: Optional[FrameType] = ...,\r
+ limit: Optional[int] = ...) -> List[str]: ...\r
+if sys.version_info >= (3, 4):\r
+ def clear_frames(tb: TracebackType) -> None: ...\r
+if sys.version_info >= (3, 5):\r
+ def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ...\r
+ def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ...\r
+if sys.version_info < (3,):\r
+ def tb_lineno(tb: TracebackType) -> int: ...\r
+\r
+\r
+if sys.version_info >= (3, 5):\r
+ class TracebackException:\r
+ __cause__ = ... # type:TracebackException\r
+ __context__ = ... # type:TracebackException\r
+ __suppress_context__ = ... # type: bool\r
+ stack = ... # type: StackSummary\r
+ exc_type = ... # type: Type[BaseException]\r
+ filename = ... # type: str\r
+ lineno = ... # type: int\r
+ text = ... # type: str\r
+ offset = ... # type: int\r
+ msg = ... # type: str\r
+ def __init__(self, exc_type: Type[BaseException],\r
+ exc_value: BaseException, exc_traceback: TracebackType,\r
+ *, limit: Optional[int] = ..., lookup_lines: bool = ...,\r
+ capture_locals: bool = ...) -> None: ...\r
+ @classmethod\r
+ def from_exception(cls, exc: BaseException,\r
+ *, limit: Optional[int] = ...,\r
+ lookup_lines: bool = ...,\r
+ capture_locals: bool = ...) -> TracebackException: ...\r
+ def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...\r
+ def format_exception_only(self) -> Generator[str, None, None]: ...\r
+\r
+\r
+if sys.version_info >= (3, 5):\r
+ class FrameSummary(Iterable):\r
+ filename: str\r
+ lineno: int\r
+ name: str\r
+ line: str\r
+ locals: Optional[Dict[str, str]]\r
+ def __init__(self, filename: str, lineno: int, name: str,\r
+ lookup_line: bool = ...,\r
+ locals: Optional[Mapping[str, str]] = ...,\r
+ line: Optional[int] = ...) -> None: ...\r
+ # TODO: more precise typing for __getitem__ and __iter__,\r
+ # for a namedtuple-like view on (filename, lineno, name, str).\r
+ def __getitem__(self, i: int) -> Any: ...\r
+ def __iter__(self) -> Iterator[Any]: ...\r
+\r
+ class StackSummary(List[FrameSummary]):\r
+ @classmethod\r
+ def extract(cls,\r
+ frame_gen: Generator[Tuple[FrameType, int], None, None],\r
+ *, limit: Optional[int] = ..., lookup_lines: bool = ...,\r
+ capture_locals: bool = ...) -> StackSummary: ...\r
+ @classmethod\r
+ def from_list(cls, a_list: List[_PT]) -> StackSummary: ...\r
+ def format(self) -> List[str]: ...\r