From 43f5c603868a5c4f237a3291815a49dc6fc367fb Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Tue, 22 Jan 2013 12:02:45 +0530 Subject: [PATCH] BUG: Opening parenthesis after non-callable raises ValueError Typing something like `None(` raises a value error. --- IPython/frontend/qt/console/call_tip_widget.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/qt/console/call_tip_widget.py b/IPython/frontend/qt/console/call_tip_widget.py index 838f03e526d..4cea749ad2b 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 @@ def _format_tooltip(self,doc): # 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)