diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2019-06-05 01:55:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 01:55:37 (GMT) |
commit | 949fe976d5c62ae63ed505ecf729f815d0baccfc (patch) | |
tree | f4757659cd68f68722a840bb70a10998b3bd412f /Lib/idlelib/calltip.py | |
parent | 59e7bbcaa4d0d556591f774c5ea4869c41fa95b0 (diff) | |
download | cpython-949fe976d5c62ae63ed505ecf729f815d0baccfc.zip cpython-949fe976d5c62ae63ed505ecf729f815d0baccfc.tar.gz cpython-949fe976d5c62ae63ed505ecf729f815d0baccfc.tar.bz2 |
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.
Diffstat (limited to 'Lib/idlelib/calltip.py')
-rw-r--r-- | Lib/idlelib/calltip.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py index b013a7f..a3dda26 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) |