mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +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:
committed by
Sebastian Rittau
parent
eeb8daa467
commit
c38cf6736e
@@ -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