mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-16 02:51:28 +08:00
Allow callables in _SourceObjectType (#3295)
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:
1 parent
eeb8daa467
commit
c38cf6736e
1 file changed
+1
-1
@@ -77,7 +77,7 @@ 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