##// 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 199 (regular functions).
200 200 """
201 201 # Get call definition
202 argspec = oinfo['argspec']
202 argspec = oinfo.get('argspec')
203 203 if argspec is None:
204 204 call_line = None
205 205 else:
@@ -218,11 +218,11 b' def call_tip(oinfo, format_call=True):'
218 218
219 219 # Now get docstring.
220 220 # The priority is: call docstring, constructor docstring, main one.
221 doc = oinfo['call_docstring']
221 doc = oinfo.get('call_docstring')
222 222 if doc is None:
223 doc = oinfo['init_docstring']
223 doc = oinfo.get('init_docstring')
224 224 if doc is None:
225 doc = oinfo['docstring']
225 doc = oinfo.get('docstring','')
226 226
227 227 return call_line, doc
228 228
@@ -355,13 +355,15 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
355 355 # line as string, later we can pass False to format_call and
356 356 # syntax-highlight it ourselves for nicer formatting in the
357 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 361 # Don't generate a call-tip for magics. Ideally, we should
360 362 # generate a tooltip, but not on ( like we do for actual
361 363 # callables.
362 364 call_info, doc = None, None
363 365 else:
364 call_info, doc = call_tip(rep['content'], format_call=True)
366 call_info, doc = call_tip(content, format_call=True)
365 367 if call_info or doc:
366 368 self._call_tip_widget.show_call_info(call_info, doc)
367 369
@@ -369,7 +371,14 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
369 371 """ Handle display hook output.
370 372 """
371 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 383 def _handle_stream(self, msg):
375 384 """ Handle stdout, stderr, and stdin.
General Comments 0
You need to be logged in to leave comments. Login now