Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-19903: IDLE: Calltips changed to use inspect.signature #2822

Merged
merged 10 commits into from
Aug 10, 2017
Prev Previous commit
Next Next commit
Addressed Terry comments
mlouielu committed Aug 3, 2017
commit 7ba520266ed0d713317256cdbabc76491d03718f
20 changes: 5 additions & 15 deletions Lib/idlelib/calltips.py
Original file line number Diff line number Diff line change
@@ -136,29 +136,19 @@ def get_argspec(ob):
empty line or _MAX_LINES. For builtins, this typically includes
the arguments in addition to the return value.
'''
argspec = ""
argspec = default = ""
try:
ob_call = ob.__call__
except BaseException:
return argspec
if isinstance(ob_call, types.MethodType):
fob = ob_call
else:
fob = ob
return default

fob = ob_call if isinstance(ob_call, types.MethodType) else ob

try:
argspec = str(inspect.signature(fob))
except ValueError as err:
msg = str(err)
if msg.startswith(_invalid_method):
argspec = _invalid_method
return argspec
elif msg.startswith('no signature found for'):
"""If no signature found for function or method"""
pass
else:
"""Callable is not supported by signature"""
pass
return _invalid_method if msg.startswith(_invalid_method) else default

if '/' in argspec:
"""Using AC's positional argument should add the explain"""