Use NamedTuple for inspect.ArgSpec and .FullArgSpec.

This commit is contained in:
Guido van Rossum
2016-01-18 16:50:00 -08:00
parent f1beef02e7
commit 740568ed25
2 changed files with 20 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
# TODO incomplete
from typing import Any, List, Tuple
from typing import Any, List, Tuple, NamedTuple
def isgenerator(object: Any) -> bool: ...
@@ -10,11 +10,10 @@ _FrameRecord = Tuple[_Frame, str, int, str, List[str], int]
def currentframe() -> _FrameRecord: ...
def stack(context: int = ...) -> List[_FrameRecord]: ...
# namedtuple('ArgSpec', 'args varargs keywords defaults')
class ArgSpec(tuple):
args = ... # type: List[str]
varargs = ... # type: str
keywords = ... # type: str
defaults = ... # type: tuple
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
('varargs', str),
('keywords', str),
('defaults', tuple),
])
def getargspec(func: object) -> ArgSpec: ...