Commit 949fe976 authored by Terry Jan Reedy's avatar Terry Jan Reedy Committed by GitHub

bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)

Add it to the end of the first line if there is room.  Tests were reworked.
parent 59e7bbca
......@@ -118,7 +118,7 @@ _INDENT = ' '*4 # for wrapped signatures
_first_param = re.compile(r'(?<=\()\w*\,?\s*')
_default_callable_argspec = "See source or doc"
_invalid_method = "invalid method signature"
_argument_positional = "\n['/' marks preceding arguments as positional-only]\n"
_argument_positional = " # '/' marks preceding args as positional-only."
def get_argspec(ob):
'''Return a string describing the signature of a callable object, or ''.
......@@ -144,11 +144,11 @@ def get_argspec(ob):
if msg.startswith(_invalid_method):
return _invalid_method
if '/' in argspec:
"""Using AC's positional argument should add the explain"""
if '/' in argspec and len(argspec) < _MAX_COLS - len(_argument_positional):
# Add explanation TODO remove after 3.7, before 3.9.
argspec += _argument_positional
if isinstance(fob, type) and argspec == '()':
"""fob with no argument, use default callable argspec"""
# If fob has no argument, use default callable argspec.
argspec = _default_callable_argspec
lines = (textwrap.wrap(argspec, _MAX_COLS, subsequent_indent=_INDENT)
......
This diff is collapsed.
Make calltip reminder about '/' meaning positional-only less obtrusive by
only adding it when there is room on the first line.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment