##// END OF EJS Templates
use dict.get(key) instead of dict[key] for pure kernel...
MinRK -
Show More
@@ -199,7 +199,7 b' def call_tip(oinfo, format_call=True):'
199 (regular functions).
199 (regular functions).
200 """
200 """
201 # Get call definition
201 # Get call definition
202 argspec = oinfo['argspec']
202 argspec = oinfo.get('argspec')
203 if argspec is None:
203 if argspec is None:
204 call_line = None
204 call_line = None
205 else:
205 else:
@@ -218,11 +218,11 b' def call_tip(oinfo, format_call=True):'
218
218
219 # Now get docstring.
219 # Now get docstring.
220 # The priority is: call docstring, constructor docstring, main one.
220 # The priority is: call docstring, constructor docstring, main one.
221 doc = oinfo['call_docstring']
221 doc = oinfo.get('call_docstring')
222 if doc is None:
222 if doc is None:
223 doc = oinfo['init_docstring']
223 doc = oinfo.get('init_docstring')
224 if doc is None:
224 if doc is None:
225 doc = oinfo['docstring']
225 doc = oinfo.get('docstring','')
226
226
227 return call_line, doc
227 return call_line, doc
228
228
@@ -355,13 +355,15 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
355 # line as string, later we can pass False to format_call and
355 # line as string, later we can pass False to format_call and
356 # syntax-highlight it ourselves for nicer formatting in the
356 # syntax-highlight it ourselves for nicer formatting in the
357 # calltip.
357 # calltip.
358 if rep['content']['ismagic']:
358 content = rep['content']
359 # if this is from pykernel, 'docstring' will be the only key
360 if content.get('ismagic', False):
359 # Don't generate a call-tip for magics. Ideally, we should
361 # Don't generate a call-tip for magics. Ideally, we should
360 # generate a tooltip, but not on ( like we do for actual
362 # generate a tooltip, but not on ( like we do for actual
361 # callables.
363 # callables.
362 call_info, doc = None, None
364 call_info, doc = None, None
363 else:
365 else:
364 call_info, doc = call_tip(rep['content'], format_call=True)
366 call_info, doc = call_tip(content, format_call=True)
365 if call_info or doc:
367 if call_info or doc:
366 self._call_tip_widget.show_call_info(call_info, doc)
368 self._call_tip_widget.show_call_info(call_info, doc)
367
369
@@ -369,7 +371,14 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
369 """ Handle display hook output.
371 """ Handle display hook output.
370 """
372 """
371 if not self._hidden and self._is_from_this_session(msg):
373 if not self._hidden and self._is_from_this_session(msg):
372 self._append_plain_text(msg['content']['data']['text/plain'] + '\n')
374 data = msg['content']['data']
375 if isinstance(data, basestring):
376 # plaintext data from pure Python kernel
377 text = data
378 else:
379 # formatted output from DisplayFormatter (IPython kernel)
380 text = data.get('text/plain', '')
381 self._append_plain_text(text + '\n')
373
382
374 def _handle_stream(self, msg):
383 def _handle_stream(self, msg):
375 """ Handle stdout, stderr, and stdin.
384 """ Handle stdout, stderr, and stdin.
General Comments 0
You need to be logged in to leave comments. Login now