1 # Stubs for traceback
\r
3 from typing import Any, Dict, Generator, IO, Iterator, List, Mapping, Optional, Tuple, Type, Iterable
\r
4 from types import FrameType, TracebackType
\r
7 _PT = Tuple[str, int, str, Optional[str]]
\r
10 def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ...,
\r
11 file: Optional[IO[str]] = ...) -> None: ...
\r
12 if sys.version_info >= (3,):
\r
13 def print_exception(etype: Optional[Type[BaseException]],
\r
14 value: Optional[BaseException],
\r
15 tb: Optional[TracebackType], limit: Optional[int] = ...,
\r
16 file: Optional[IO[str]] = ...,
\r
17 chain: bool = ...) -> None: ...
\r
18 def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ...,
\r
19 chain: bool = ...) -> None: ...
\r
20 def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ...,
\r
21 chain: bool = ...) -> None: ...
\r
23 def print_exception(etype: Optional[Type[BaseException]],
\r
24 value: Optional[BaseException],
\r
25 tb: Optional[TracebackType], limit: Optional[int] = ...,
\r
26 file: Optional[IO[str]] = ...) -> None: ...
\r
27 def print_exc(limit: Optional[int] = ...,
\r
28 file: Optional[IO[str]] = ...) -> None: ...
\r
29 def print_last(limit: Optional[int] = ...,
\r
30 file: Optional[IO[str]] = ...) -> None: ...
\r
31 def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...,
\r
32 file: Optional[IO[str]] = ...) -> None: ...
\r
34 if sys.version_info >= (3, 5):
\r
35 def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...
\r
36 def extract_stack(f: Optional[FrameType] = ...,
\r
37 limit: Optional[int] = ...) -> StackSummary: ...
\r
38 def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
\r
40 def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ...
\r
41 def extract_stack(f: Optional[FrameType] = ...,
\r
42 limit: Optional[int] = ...) -> List[_PT]: ...
\r
43 def format_list(extracted_list: List[_PT]) -> List[str]: ...
\r
44 def format_exception_only(etype: Optional[Type[BaseException]],
\r
45 value: Optional[BaseException]) -> List[str]: ...
\r
46 if sys.version_info >= (3,):
\r
47 def format_exception(etype: Optional[Type[BaseException]], value: Optional[BaseException],
\r
48 tb: Optional[TracebackType], limit: Optional[int] = ...,
\r
49 chain: bool = ...) -> List[str]: ...
\r
50 def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ...
\r
52 def format_exception(etype: Optional[Type[BaseException]],
\r
53 value: Optional[BaseException],
\r
54 tb: Optional[TracebackType],
\r
55 limit: Optional[int] = ...) -> List[str]: ...
\r
56 def format_exc(limit: Optional[int] = ...) -> str: ...
\r
57 def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ...
\r
58 def format_stack(f: Optional[FrameType] = ...,
\r
59 limit: Optional[int] = ...) -> List[str]: ...
\r
60 if sys.version_info >= (3, 4):
\r
61 def clear_frames(tb: TracebackType) -> None: ...
\r
62 if sys.version_info >= (3, 5):
\r
63 def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ...
\r
64 def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ...
\r
65 if sys.version_info < (3,):
\r
66 def tb_lineno(tb: TracebackType) -> int: ...
\r
69 if sys.version_info >= (3, 5):
\r
70 class TracebackException:
\r
71 __cause__ = ... # type:TracebackException
\r
72 __context__ = ... # type:TracebackException
\r
73 __suppress_context__ = ... # type: bool
\r
74 stack = ... # type: StackSummary
\r
75 exc_type = ... # type: Type[BaseException]
\r
76 filename = ... # type: str
\r
77 lineno = ... # type: int
\r
78 text = ... # type: str
\r
79 offset = ... # type: int
\r
80 msg = ... # type: str
\r
81 def __init__(self, exc_type: Type[BaseException],
\r
82 exc_value: BaseException, exc_traceback: TracebackType,
\r
83 *, limit: Optional[int] = ..., lookup_lines: bool = ...,
\r
84 capture_locals: bool = ...) -> None: ...
\r
86 def from_exception(cls, exc: BaseException,
\r
87 *, limit: Optional[int] = ...,
\r
88 lookup_lines: bool = ...,
\r
89 capture_locals: bool = ...) -> TracebackException: ...
\r
90 def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
\r
91 def format_exception_only(self) -> Generator[str, None, None]: ...
\r
94 if sys.version_info >= (3, 5):
\r
95 class FrameSummary(Iterable):
\r
100 locals: Optional[Dict[str, str]]
\r
101 def __init__(self, filename: str, lineno: int, name: str,
\r
102 lookup_line: bool = ...,
\r
103 locals: Optional[Mapping[str, str]] = ...,
\r
104 line: Optional[int] = ...) -> None: ...
\r
105 # TODO: more precise typing for __getitem__ and __iter__,
\r
106 # for a namedtuple-like view on (filename, lineno, name, str).
\r
107 def __getitem__(self, i: int) -> Any: ...
\r
108 def __iter__(self) -> Iterator[Any]: ...
\r
110 class StackSummary(List[FrameSummary]):
\r
113 frame_gen: Generator[Tuple[FrameType, int], None, None],
\r
114 *, limit: Optional[int] = ..., lookup_lines: bool = ...,
\r
115 capture_locals: bool = ...) -> StackSummary: ...
\r
117 def from_list(cls, a_list: List[_PT]) -> StackSummary: ...
\r
118 def format(self) -> List[str]: ...
\r