mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Use NamedTuple for inspect.ArgSpec and .FullArgSpec.
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Stubs for inspect
|
||||
|
||||
from typing import Any, Tuple, List, Dict, Callable
|
||||
from typing import Any, Tuple, List, Dict, Callable, NamedTuple
|
||||
from types import FrameType
|
||||
|
||||
_object = object
|
||||
@@ -22,24 +22,22 @@ def cleandoc(doc: str) -> str: ...
|
||||
|
||||
def getsourcelines(obj: object) -> Tuple[List[str], int]: ...
|
||||
|
||||
# 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: ...
|
||||
|
||||
# namedtuple('FullArgSpec', 'args varargs varkw defaults kwonlyargs kwonlydefaults annotations')
|
||||
class FullArgSpec(tuple):
|
||||
args = ... # type: List[str]
|
||||
varargs = ... # type: str
|
||||
varkw = ... # type: str
|
||||
defaults = ... # type: tuple
|
||||
kwonlyargs = ... # type: List[str]
|
||||
kwonlydefaults = ... # type: Dict[str, Any]
|
||||
annotations = ... # type: Dict[str, Any]
|
||||
FullArgSpec = NamedTuple('FullArgSpec', [('args', List[str]),
|
||||
('varargs', str),
|
||||
('varkw', str),
|
||||
('defaults', tuple),
|
||||
('kwonlyargs', List[str]),
|
||||
('kwonlydefaults', Dict[str, Any]),
|
||||
('annotations', Dict[str, Any]),
|
||||
])
|
||||
|
||||
def getfullargspec(func: object) -> FullArgSpec: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user