From 72ecc7a18da505cd5de5d0fbd28e7609b7897fc3 Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Wed, 2 Jan 2019 16:42:42 -0300 Subject: [PATCH 1/5] Fix bpo-35641 --- Lib/idlelib/calltip.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py index 758569a45fdf581..0a3aeccc815b685 100644 --- a/Lib/idlelib/calltip.py +++ b/Lib/idlelib/calltip.py @@ -155,6 +155,7 @@ def get_argspec(ob): lines = (textwrap.wrap(argspec, _MAX_COLS, subsequent_indent=_INDENT) if len(argspec) > _MAX_COLS else [argspec] if argspec else []) + print(lines) if isinstance(ob_call, types.MethodType): doc = ob_call.__doc__ else: @@ -167,7 +168,7 @@ def get_argspec(ob): if len(line) > _MAX_COLS: line = line[: _MAX_COLS - 3] + '...' lines.append(line) - argspec = '\n'.join(lines) + argspec = '\n'.join(lines) if not argspec: argspec = _default_callable_argspec return argspec From 3ff0b60dbde564cd7e4ffd4df3034d01f7172658 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 2 Jan 2019 15:10:25 -0500 Subject: [PATCH 2/5] Update calltip.py remove debug line --- Lib/idlelib/calltip.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py index 0a3aeccc815b685..2a9a131ed96b3c7 100644 --- a/Lib/idlelib/calltip.py +++ b/Lib/idlelib/calltip.py @@ -155,7 +155,6 @@ def get_argspec(ob): lines = (textwrap.wrap(argspec, _MAX_COLS, subsequent_indent=_INDENT) if len(argspec) > _MAX_COLS else [argspec] if argspec else []) - print(lines) if isinstance(ob_call, types.MethodType): doc = ob_call.__doc__ else: From ca3a75a5fa2dfa71c38b50b4a62b6c7748ba647c Mon Sep 17 00:00:00 2001 From: eamanu Date: Wed, 2 Jan 2019 22:15:27 -0300 Subject: [PATCH 3/5] Adding test case and NEWS --- Lib/idlelib/idle_test/test_calltip.py | 29 +++++++++++++++++++ .../2019-01-02-22-15-01.bpo-35641.QEaANl.rst | 1 + 2 files changed, 30 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst diff --git a/Lib/idlelib/idle_test/test_calltip.py b/Lib/idlelib/idle_test/test_calltip.py index 0698d4f8b99ea99..833351bd799601d 100644 --- a/Lib/idlelib/idle_test/test_calltip.py +++ b/Lib/idlelib/idle_test/test_calltip.py @@ -99,6 +99,35 @@ def test_signature_wrap(self): drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, placeholder=' [...]')''') + def test_properly_formated(self): + def foo(s='a'*100): + pass + + def bar(s='a'*100): + """Hello Guido""" + pass + + def baz(s='a'*100, z='b'*100): + pass + + indent = calltip._INDENT + + str_foo = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')" + str_bar = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa')\nHello Guido" + str_baz = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\ + "aaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbb\n" + indent + "bbbbbbbbbbbbbbbbbbbbbb"\ + "bbbbbbbbbbbbbbbbbbbbbb')" + + self.assertEqual(calltip.get_argspec(foo), str_foo) + self.assertEqual(calltip.get_argspec(bar), str_bar) + self.assertEqual(calltip.get_argspec(baz), str_baz) + def test_docline_truncation(self): def f(): pass f.__doc__ = 'a'*300 diff --git a/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst b/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst new file mode 100644 index 000000000000000..8d084b95ca9715e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst @@ -0,0 +1 @@ +`calltip` get signature properly formated for function with not docstring From 46101b8b63a2faffc0294f92abeaa3204b6eb3d0 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 3 Jan 2019 01:05:57 -0500 Subject: [PATCH 4/5] Update 2019-01-02-22-15-01.bpo-35641.QEaANl.rst --- .../next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst b/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst index 8d084b95ca9715e..5abba690be4836b 100644 --- a/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst +++ b/Misc/NEWS.d/next/Library/2019-01-02-22-15-01.bpo-35641.QEaANl.rst @@ -1 +1 @@ -`calltip` get signature properly formated for function with not docstring +Proper format `calltip` when the function has no docstring. From ebe68363ad85fee21c1d04bf270c98f44277e44c Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 3 Jan 2019 01:22:38 -0500 Subject: [PATCH 5/5] Add Emmanuel Arias to misc/acks. --- Misc/ACKS | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/ACKS b/Misc/ACKS index 63df5df4cbefcb0..49b28153d3f7df2 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -60,6 +60,7 @@ Heidi Annexstad Ramchandra Apte Éric Araujo Alexandru Ardelean +Emmanuel Arias Alicia Arlen Jeffrey Armstrong Jason Asbahr