mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
2.7/inspect: add getframeinfo, getouterframes, Traceback (#588)
This commit is contained in:
committed by
Matthias Kramm
parent
674fe2b59f
commit
9b092f353e
@@ -1,6 +1,6 @@
|
||||
# TODO incomplete
|
||||
from types import TracebackType, FrameType, ModuleType
|
||||
from typing import Any, Callable, List, Optional, Tuple, NamedTuple
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union, NamedTuple
|
||||
|
||||
# Types and members
|
||||
ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
|
||||
@@ -64,13 +64,20 @@ def getmro(cls: type) -> Tuple[type, ...]: ...
|
||||
# TODO getcallargs
|
||||
|
||||
# The interpreter stack
|
||||
# TODO getframeinfo
|
||||
# TODO getouterframes
|
||||
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[FrameType]:
|
||||
...
|
||||
|
||||
Traceback = NamedTuple('Traceback', [('filename', str),
|
||||
('lineno', int),
|
||||
('function', str),
|
||||
('code_context', List[str]),
|
||||
('index', int),
|
||||
])
|
||||
|
||||
_FrameRecord = Tuple[FrameType, str, int, str, List[str], int]
|
||||
|
||||
def getouterframes(frame: FrameType, context: int = ...) -> List[FrameType]: ...
|
||||
def getframeinfo(frame: Union[FrameType, TracebackType] , context: int = ...) -> Traceback: ...
|
||||
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[FrameType]: ...
|
||||
|
||||
def currentframe() -> FrameType: ...
|
||||
def stack(context: int = ...) -> List[_FrameRecord]: ...
|
||||
def trace(context: int = ...) -> List[_FrameRecord]: ...
|
||||
|
||||
Reference in New Issue
Block a user