mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-27 22:31:12 +08:00
Add undocumented but occasionally used attributes to inspect.pyi. (#1864)
* Add attributes not in docs to 2/inspect.pyi. * Add attributes not in docs to 3/inspect.pyi. * Change list to List[Any] in 2/inspect.pyi
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
from types import TracebackType, FrameType, ModuleType
|
||||
from typing import Any, Dict, Callable, List, Optional, Tuple, Union, NamedTuple, Type
|
||||
from types import CodeType, TracebackType, FrameType, ModuleType
|
||||
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
|
||||
|
||||
# Types and members
|
||||
class EndOfBlock(Exception): ...
|
||||
|
||||
class BlockFinder:
|
||||
indent: int
|
||||
islambda: bool
|
||||
started: bool
|
||||
passline: bool
|
||||
last: int
|
||||
def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int],
|
||||
erow_ecol: Tuple[int, int], line: str) -> None: ...
|
||||
|
||||
CO_GENERATOR = ... # type: int
|
||||
CO_NESTED = ... # type: int
|
||||
CO_NEWLOCALS = ... # type: int
|
||||
CO_NOFREE = ... # type: int
|
||||
CO_OPTIMIZED = ... # type: int
|
||||
CO_VARARGS = ... # type: int
|
||||
CO_VARKEYWORDS = ... # type: int
|
||||
TPFLAGS_IS_ABSTRACT = ... # type: int
|
||||
|
||||
ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
|
||||
('suffix', str),
|
||||
('mode', str),
|
||||
@@ -32,6 +52,9 @@ def isgetsetdescriptor(object: object) -> bool: ...
|
||||
def ismemberdescriptor(object: object) -> bool: ...
|
||||
|
||||
# Retrieving source code
|
||||
def findsource(object: object) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: object) -> str: ...
|
||||
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
|
||||
def getdoc(object: object) -> str: ...
|
||||
def getcomments(object: object) -> str: ...
|
||||
def getfile(object: object) -> str: ...
|
||||
@@ -44,6 +67,7 @@ def getsourcelines(object: object) -> Tuple[List[str], int]: ...
|
||||
# or code object"
|
||||
def getsource(object: object) -> str: ...
|
||||
def cleandoc(doc: str) -> str: ...
|
||||
def indentsize(line: str) -> int: ...
|
||||
|
||||
# Classes and functions
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[
|
||||
@@ -61,6 +85,12 @@ ArgInfo = NamedTuple('ArgInfo', [('args', List[str]),
|
||||
('locals', Dict[str, Any]),
|
||||
])
|
||||
|
||||
Arguments = NamedTuple('Arguments', [('args', List[Union[str, List[Any]]]),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
])
|
||||
|
||||
def getargs(co: CodeType) -> Arguments: ...
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
def getargvalues(frame: FrameType) -> ArgInfo: ...
|
||||
def formatargspec(args, varargs=..., varkw=..., defaults=...,
|
||||
@@ -90,7 +120,16 @@ _FrameInfo = Tuple[FrameType, str, int, str, List[str], int]
|
||||
def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ...
|
||||
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
|
||||
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ...
|
||||
def getlineno(frame: FrameType) -> int: ...
|
||||
|
||||
def currentframe(depth: int = ...) -> FrameType: ...
|
||||
def stack(context: int = ...) -> List[_FrameInfo]: ...
|
||||
def trace(context: int = ...) -> List[_FrameInfo]: ...
|
||||
|
||||
Attribute = NamedTuple('Attribute', [('name', str),
|
||||
('kind', str),
|
||||
('defining_class', type),
|
||||
('object', object),
|
||||
])
|
||||
|
||||
def classify_class_attrs(cls: type) -> List[Attribute]: ...
|
||||
|
||||
Reference in New Issue
Block a user