Skip to content

Commit

Permalink
Merge pull request #2830 from punchagan/fix-format-tooltip
Browse files Browse the repository at this point in the history
BUG: Opening parenthesis after non-callable raises ValueError
  • Loading branch information
bfroehle committed Jan 22, 2013
2 parents 42886e3 + 43f5c60 commit 21c6d8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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
Expand Down Expand Up @@ -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 '<no docstring>' 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)
Expand Down

0 comments on commit 21c6d8f

Please sign in to comment.