mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
Allow callables in _SourceObjectType (Python 2) (#3338)
This is important because mypy doesn't generally think functions are compatible with `FunctionType`, so `inspect.getsource` on arbitrary functions is rejected by the current annotations.
This commit is contained in:
committed by
Jelle Zijlstra
parent
d41bcd39e1
commit
9b0922166a
@@ -52,7 +52,7 @@ def isgetsetdescriptor(object: object) -> bool: ...
|
||||
def ismemberdescriptor(object: object) -> bool: ...
|
||||
|
||||
# Retrieving source code
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType]
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user