From 949fe976d5c62ae63ed505ecf729f815d0baccfc Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 4 Jun 2019 21:55:37 -0400 Subject: 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. --- Lib/idlelib/calltip.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Lib/idlelib/calltip.py') diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py index b013a7f6ec..a3dda2678b 100644 --- a/Lib/idlelib/calltip.py +++ b/Lib/idlelib/calltip.py @@ -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) -- cgit v1.2.1