mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
improve inspect.pyi (#908)
This commit is contained in:
committed by
Guido van Rossum
parent
293dcfa661
commit
295ffbe4f3
@@ -1,6 +1,5 @@
|
||||
# TODO incomplete
|
||||
from types import TracebackType, FrameType, ModuleType
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union, NamedTuple
|
||||
from typing import Any, Dict, Callable, List, Optional, Tuple, Union, NamedTuple, Type
|
||||
|
||||
# Types and members
|
||||
ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
|
||||
@@ -47,22 +46,25 @@ def getsource(object: object) -> str: ...
|
||||
def cleandoc(doc: str) -> str: ...
|
||||
|
||||
# Classes and functions
|
||||
# TODO make the return type more specific
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> Any: ...
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[
|
||||
Union[Tuple[type, Tuple[type, ...]], list]]: ...
|
||||
|
||||
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
|
||||
('varargs', str),
|
||||
('keywords', str),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
('defaults', tuple),
|
||||
])
|
||||
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
# TODO make the return type more specific
|
||||
def getargvalues(frame: FrameType) -> Any: ...
|
||||
# TODO formatargspec
|
||||
# TODO formatargvalues
|
||||
def getargvalues(frame: FrameType) -> ArgSpec: ...
|
||||
def formatargspec(args, varargs=..., varkw=..., defaults=...,
|
||||
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
|
||||
join=...) -> str: ...
|
||||
def formatargvalues(args, varargs=..., varkw=..., defaults=...,
|
||||
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
|
||||
join=...) -> str: ...
|
||||
def getmro(cls: type) -> Tuple[type, ...]: ...
|
||||
# TODO getcallargs
|
||||
def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...
|
||||
|
||||
# The interpreter stack
|
||||
|
||||
@@ -83,6 +85,6 @@ 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 currentframe(depth: int = ...) -> FrameType: ...
|
||||
def stack(context: int = ...) -> List[_FrameRecord]: ...
|
||||
def trace(context: int = ...) -> List[_FrameRecord]: ...
|
||||
|
||||
Reference in New Issue
Block a user