From 21c6d8febb2225a53daa27e5b21fc994372ca6c5 2013-01-22 06:55:10 From: Bradley M. Froehle Date: 2013-01-22 06:55:10 Subject: [PATCH] Merge pull request #2830 from punchagan/fix-format-tooltip BUG: Opening parenthesis after non-callable raises ValueError --- diff --git a/IPython/frontend/qt/console/call_tip_widget.py b/IPython/frontend/qt/console/call_tip_widget.py index 838f03e..4cea749 100644 --- a/IPython/frontend/qt/console/call_tip_widget.py +++ b/IPython/frontend/qt/console/call_tip_widget.py @@ -1,6 +1,5 @@ # Standard library imports import re -from textwrap import dedent from unicodedata import category # System library imports @@ -254,6 +253,9 @@ class CallTipWidget(QtGui.QLabel): # make sure a long argument list does not make # the first row overflow the width of the actual tip body rows = doc.split("\n") + # An object which is not a callable has '' as doc + if len(rows) == 1: + return doc max_text_width = max(80, max([len(x) for x in rows[1:]])) rows= textwrap.wrap(rows[0],max_text_width) + rows[1:] doc = "\n".join(rows)