##// END OF EJS Templates
Merge pull request #1791 from minrk/zmq_magics...
Fernando Perez -
r7084:fa202107 merge
parent child Browse files
Show More
@@ -174,7 +174,8 b' class CodeMagics(Magics):'
174
174
175 self.shell.set_next_input(contents)
175 self.shell.set_next_input(contents)
176
176
177 def _find_edit_target(self, args, opts, last_call):
177 @staticmethod
178 def _find_edit_target(shell, args, opts, last_call):
178 """Utility method used by magic_edit to find what to edit."""
179 """Utility method used by magic_edit to find what to edit."""
179
180
180 def make_filename(arg):
181 def make_filename(arg):
@@ -203,13 +204,13 b' class CodeMagics(Magics):'
203
204
204 if opts_prev:
205 if opts_prev:
205 args = '_%s' % last_call[0]
206 args = '_%s' % last_call[0]
206 if not self.shell.user_ns.has_key(args):
207 if not shell.user_ns.has_key(args):
207 args = last_call[1]
208 args = last_call[1]
208
209
209 # use last_call to remember the state of the previous call, but don't
210 # use last_call to remember the state of the previous call, but don't
210 # let it be clobbered by successive '-p' calls.
211 # let it be clobbered by successive '-p' calls.
211 try:
212 try:
212 last_call[0] = self.shell.displayhook.prompt_count
213 last_call[0] = shell.displayhook.prompt_count
213 if not opts_prev:
214 if not opts_prev:
214 last_call[1] = args
215 last_call[1] = args
215 except:
216 except:
@@ -227,14 +228,14 b' class CodeMagics(Magics):'
227 use_temp = False
228 use_temp = False
228 elif args:
229 elif args:
229 # Mode where user specifies ranges of lines, like in %macro.
230 # Mode where user specifies ranges of lines, like in %macro.
230 data = self.shell.extract_input_lines(args, opts_raw)
231 data = shell.extract_input_lines(args, opts_raw)
231 if not data:
232 if not data:
232 try:
233 try:
233 # Load the parameter given as a variable. If not a string,
234 # Load the parameter given as a variable. If not a string,
234 # process it as an object instead (below)
235 # process it as an object instead (below)
235
236
236 #print '*** args',args,'type',type(args) # dbg
237 #print '*** args',args,'type',type(args) # dbg
237 data = eval(args, self.shell.user_ns)
238 data = eval(args, shell.user_ns)
238 if not isinstance(data, basestring):
239 if not isinstance(data, basestring):
239 raise DataIsObject
240 raise DataIsObject
240
241
@@ -293,7 +294,7 b' class CodeMagics(Magics):'
293 use_temp = False
294 use_temp = False
294
295
295 if use_temp:
296 if use_temp:
296 filename = self.shell.mktempfile(data)
297 filename = shell.mktempfile(data)
297 print 'IPython will make a temporary file named:',filename
298 print 'IPython will make a temporary file named:',filename
298
299
299 return filename, lineno, use_temp
300 return filename, lineno, use_temp
@@ -538,3 +538,11 b' default_gui_banner_parts = default_banner_parts + [gui_note]'
538 default_banner = ''.join(default_banner_parts)
538 default_banner = ''.join(default_banner_parts)
539
539
540 default_gui_banner = ''.join(default_gui_banner_parts)
540 default_gui_banner = ''.join(default_gui_banner_parts)
541
542 # page GUI Reference, for use as a magic:
543
544 def page_guiref(arg_s=None):
545 """Show a basic reference about the GUI Console."""
546 from IPython.core import page
547 page.page(gui_reference, auto_html=True)
548
@@ -25,6 +25,7 b' class BaseFrontendMixin(object):'
25 # Disconnect the old kernel manager, if necessary.
25 # Disconnect the old kernel manager, if necessary.
26 old_manager = self._kernel_manager
26 old_manager = self._kernel_manager
27 if old_manager is not None:
27 if old_manager is not None:
28 old_manager.started_kernel.disconnect(self._started_kernel)
28 old_manager.started_channels.disconnect(self._started_channels)
29 old_manager.started_channels.disconnect(self._started_channels)
29 old_manager.stopped_channels.disconnect(self._stopped_channels)
30 old_manager.stopped_channels.disconnect(self._stopped_channels)
30
31
@@ -45,6 +46,7 b' class BaseFrontendMixin(object):'
45 return
46 return
46
47
47 # Connect the new kernel manager.
48 # Connect the new kernel manager.
49 kernel_manager.started_kernel.connect(self._started_kernel)
48 kernel_manager.started_channels.connect(self._started_channels)
50 kernel_manager.started_channels.connect(self._started_channels)
49 kernel_manager.stopped_channels.connect(self._stopped_channels)
51 kernel_manager.stopped_channels.connect(self._stopped_channels)
50
52
@@ -78,6 +80,11 b' class BaseFrontendMixin(object):'
78 The time since the heartbeat was last received.
80 The time since the heartbeat was last received.
79 """
81 """
80
82
83 def _started_kernel(self):
84 """Called when the KernelManager starts (or restarts) the kernel subprocess.
85 Channels may or may not be running at this point.
86 """
87
81 def _started_channels(self):
88 def _started_channels(self):
82 """ Called when the KernelManager channels have started listening or
89 """ Called when the KernelManager channels have started listening or
83 when the frontend is assigned an already listening KernelManager.
90 when the frontend is assigned an already listening KernelManager.
@@ -255,11 +255,27 b' class IPythonWidget(FrontendWidget):'
255 self._append_plain_text(u'\n', True)
255 self._append_plain_text(u'\n', True)
256
256
257 def _started_channels(self):
257 def _started_channels(self):
258 """ Reimplemented to make a history request.
258 """Reimplemented to make a history request and load %guiref."""
259 """
260 super(IPythonWidget, self)._started_channels()
259 super(IPythonWidget, self)._started_channels()
260 self._load_guiref_magic()
261 self.kernel_manager.shell_channel.history(hist_access_type='tail',
261 self.kernel_manager.shell_channel.history(hist_access_type='tail',
262 n=1000)
262 n=1000)
263
264 def _started_kernel(self):
265 """Load %guiref when the kernel starts (if channels are also started).
266
267 Principally triggered by kernel restart.
268 """
269 if self.kernel_manager.shell_channel is not None:
270 self._load_guiref_magic()
271
272 def _load_guiref_magic(self):
273 """Load %guiref magic."""
274 self.kernel_manager.shell_channel.execute('\n'.join([
275 "from IPython.core import usage",
276 "get_ipython().register_magic_function(usage.page_guiref, 'line', 'guiref')",
277 ]), silent=True)
278
263 #---------------------------------------------------------------------------
279 #---------------------------------------------------------------------------
264 # 'ConsoleWidget' public interface
280 # 'ConsoleWidget' public interface
265 #---------------------------------------------------------------------------
281 #---------------------------------------------------------------------------
@@ -183,6 +183,9 b' class QtKernelManager(KernelManager, SuperQObject):'
183 __metaclass__ = MetaQObjectHasTraits
183 __metaclass__ = MetaQObjectHasTraits
184
184
185 # Emitted when the kernel manager has started listening.
185 # Emitted when the kernel manager has started listening.
186 started_kernel = QtCore.Signal()
187
188 # Emitted when the kernel manager has started listening.
186 started_channels = QtCore.Signal()
189 started_channels = QtCore.Signal()
187
190
188 # Emitted when the kernel manager has stopped listening.
191 # Emitted when the kernel manager has stopped listening.
@@ -206,6 +209,7 b' class QtKernelManager(KernelManager, SuperQObject):'
206 if self._shell_channel is not None:
209 if self._shell_channel is not None:
207 self._shell_channel.reset_first_reply()
210 self._shell_channel.reset_first_reply()
208 super(QtKernelManager, self).start_kernel(*args, **kw)
211 super(QtKernelManager, self).start_kernel(*args, **kw)
212 self.started_kernel.emit()
209
213
210 #------ Channel management -------------------------------------------------
214 #------ Channel management -------------------------------------------------
211
215
@@ -16,11 +16,9 b' machinery. This should thus be thought of as scaffolding.'
16 from __future__ import print_function
16 from __future__ import print_function
17
17
18 # Stdlib
18 # Stdlib
19 import inspect
20 import os
19 import os
21 import sys
20 import sys
22 import time
21 import time
23 from subprocess import Popen, PIPE
24
22
25 # System library imports
23 # System library imports
26 from zmq.eventloop import ioloop
24 from zmq.eventloop import ioloop
@@ -29,11 +27,11 b' from zmq.eventloop import ioloop'
29 from IPython.core.interactiveshell import (
27 from IPython.core.interactiveshell import (
30 InteractiveShell, InteractiveShellABC
28 InteractiveShell, InteractiveShellABC
31 )
29 )
32 from IPython.core import page, pylabtools
30 from IPython.core import page
33 from IPython.core.autocall import ZMQExitAutocall
31 from IPython.core.autocall import ZMQExitAutocall
34 from IPython.core.displaypub import DisplayPublisher
32 from IPython.core.displaypub import DisplayPublisher
35 from IPython.core.macro import Macro
33 from IPython.core.magics import MacroToEdit, CodeMagics
36 from IPython.core.magics import MacroToEdit
34 from IPython.core.magic import magics_class, line_magic, Magics
37 from IPython.core.payloadpage import install_payload_page
35 from IPython.core.payloadpage import install_payload_page
38 from IPython.lib.kernel import (
36 from IPython.lib.kernel import (
39 get_connection_file, get_connection_info, connect_qtconsole
37 get_connection_file, get_connection_info, connect_qtconsole
@@ -41,7 +39,6 b' from IPython.lib.kernel import ('
41 from IPython.testing.skipdoctest import skip_doctest
39 from IPython.testing.skipdoctest import skip_doctest
42 from IPython.utils import io
40 from IPython.utils import io
43 from IPython.utils.jsonutil import json_clean
41 from IPython.utils.jsonutil import json_clean
44 from IPython.utils.path import get_py_filename
45 from IPython.utils.process import arg_split
42 from IPython.utils.process import arg_split
46 from IPython.utils.traitlets import Instance, Type, Dict, CBool, CBytes
43 from IPython.utils.traitlets import Instance, Type, Dict, CBool, CBytes
47 from IPython.utils.warn import warn, error
44 from IPython.utils.warn import warn, error
@@ -99,106 +96,8 b' class ZMQDisplayPublisher(DisplayPublisher):'
99 parent=self.parent_header, ident=self.topic,
96 parent=self.parent_header, ident=self.topic,
100 )
97 )
101
98
102 class ZMQInteractiveShell(InteractiveShell):
99 @magics_class
103 """A subclass of InteractiveShell for ZMQ."""
100 class KernelMagics(Magics):
104
105 displayhook_class = Type(ZMQShellDisplayHook)
106 display_pub_class = Type(ZMQDisplayPublisher)
107
108 # Override the traitlet in the parent class, because there's no point using
109 # readline for the kernel. Can be removed when the readline code is moved
110 # to the terminal frontend.
111 colors_force = CBool(True)
112 readline_use = CBool(False)
113 # autoindent has no meaning in a zmqshell, and attempting to enable it
114 # will print a warning in the absence of readline.
115 autoindent = CBool(False)
116
117 exiter = Instance(ZMQExitAutocall)
118 def _exiter_default(self):
119 return ZMQExitAutocall(self)
120
121 def _exit_now_changed(self, name, old, new):
122 """stop eventloop when exit_now fires"""
123 if new:
124 loop = ioloop.IOLoop.instance()
125 loop.add_timeout(time.time()+0.1, loop.stop)
126
127 keepkernel_on_exit = None
128
129 # Over ZeroMQ, GUI control isn't done with PyOS_InputHook as there is no
130 # interactive input being read; we provide event loop support in ipkernel
131 from .eventloops import enable_gui
132 enable_gui = staticmethod(enable_gui)
133
134 def init_environment(self):
135 """Configure the user's environment.
136
137 """
138 env = os.environ
139 # These two ensure 'ls' produces nice coloring on BSD-derived systems
140 env['TERM'] = 'xterm-color'
141 env['CLICOLOR'] = '1'
142 # Since normal pagers don't work at all (over pexpect we don't have
143 # single-key control of the subprocess), try to disable paging in
144 # subprocesses as much as possible.
145 env['PAGER'] = 'cat'
146 env['GIT_PAGER'] = 'cat'
147
148 # And install the payload version of page.
149 install_payload_page()
150
151 def auto_rewrite_input(self, cmd):
152 """Called to show the auto-rewritten input for autocall and friends.
153
154 FIXME: this payload is currently not correctly processed by the
155 frontend.
156 """
157 new = self.prompt_manager.render('rewrite') + cmd
158 payload = dict(
159 source='IPython.zmq.zmqshell.ZMQInteractiveShell.auto_rewrite_input',
160 transformed_input=new,
161 )
162 self.payload_manager.write_payload(payload)
163
164 def ask_exit(self):
165 """Engage the exit actions."""
166 self.exit_now = True
167 payload = dict(
168 source='IPython.zmq.zmqshell.ZMQInteractiveShell.ask_exit',
169 exit=True,
170 keepkernel=self.keepkernel_on_exit,
171 )
172 self.payload_manager.write_payload(payload)
173
174 def _showtraceback(self, etype, evalue, stb):
175
176 exc_content = {
177 u'traceback' : stb,
178 u'ename' : unicode(etype.__name__),
179 u'evalue' : unicode(evalue)
180 }
181
182 dh = self.displayhook
183 # Send exception info over pub socket for other clients than the caller
184 # to pick up
185 topic = None
186 if dh.topic:
187 topic = dh.topic.replace(b'pyout', b'pyerr')
188
189 exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header, ident=topic)
190
191 # FIXME - Hack: store exception info in shell object. Right now, the
192 # caller is reading this info after the fact, we need to fix this logic
193 # to remove this hack. Even uglier, we need to store the error status
194 # here, because in the main loop, the logic that sets it is being
195 # skipped because runlines swallows the exceptions.
196 exc_content[u'status'] = u'error'
197 self._reply_content = exc_content
198 # /FIXME
199
200 return exc_content
201
202 #------------------------------------------------------------------------
101 #------------------------------------------------------------------------
203 # Magic overrides
102 # Magic overrides
204 #------------------------------------------------------------------------
103 #------------------------------------------------------------------------
@@ -207,7 +106,8 b' class ZMQInteractiveShell(InteractiveShell):'
207 # the magics which this class needs to implement differently from the base
106 # the magics which this class needs to implement differently from the base
208 # class, or that are unique to it.
107 # class, or that are unique to it.
209
108
210 def magic_doctest_mode(self,parameter_s=''):
109 @line_magic
110 def doctest_mode(self, parameter_s=''):
211 """Toggle doctest mode on and off.
111 """Toggle doctest mode on and off.
212
112
213 This mode is intended to make IPython behave as much as possible like a
113 This mode is intended to make IPython behave as much as possible like a
@@ -253,12 +153,12 b' class ZMQInteractiveShell(InteractiveShell):'
253 # turn on
153 # turn on
254 ptformatter.pprint = False
154 ptformatter.pprint = False
255 disp_formatter.plain_text_only = True
155 disp_formatter.plain_text_only = True
256 shell.magic_xmode('Plain')
156 shell.magic('xmode Plain')
257 else:
157 else:
258 # turn off
158 # turn off
259 ptformatter.pprint = dstore.rc_pprint
159 ptformatter.pprint = dstore.rc_pprint
260 disp_formatter.plain_text_only = dstore.rc_plain_text_only
160 disp_formatter.plain_text_only = dstore.rc_plain_text_only
261 shell.magic_xmode(dstore.xmode)
161 shell.magic("xmode " + dstore.xmode)
262
162
263 # Store new mode and inform on console
163 # Store new mode and inform on console
264 dstore.mode = bool(1-int(mode))
164 dstore.mode = bool(1-int(mode))
@@ -267,12 +167,16 b' class ZMQInteractiveShell(InteractiveShell):'
267
167
268 # Send the payload back so that clients can modify their prompt display
168 # Send the payload back so that clients can modify their prompt display
269 payload = dict(
169 payload = dict(
270 source='IPython.zmq.zmqshell.ZMQInteractiveShell.magic_doctest_mode',
170 source='IPython.zmq.zmqshell.ZMQInteractiveShell.doctest_mode',
271 mode=dstore.mode)
171 mode=dstore.mode)
272 self.payload_manager.write_payload(payload)
172 shell.payload_manager.write_payload(payload)
173
174
175 _find_edit_target = CodeMagics._find_edit_target
273
176
274 @skip_doctest
177 @skip_doctest
275 def magic_edit(self,parameter_s='',last_call=['','']):
178 @line_magic
179 def edit(self, parameter_s='', last_call=['','']):
276 """Bring up an editor and execute the resulting code.
180 """Bring up an editor and execute the resulting code.
277
181
278 Usage:
182 Usage:
@@ -404,7 +308,7 b' class ZMQInteractiveShell(InteractiveShell):'
404 opts,args = self.parse_options(parameter_s,'prn:')
308 opts,args = self.parse_options(parameter_s,'prn:')
405
309
406 try:
310 try:
407 filename, lineno, _ = self._find_edit_target(args, opts, last_call)
311 filename, lineno, _ = CodeMagics._find_edit_target(self.shell, args, opts, last_call)
408 except MacroToEdit as e:
312 except MacroToEdit as e:
409 # TODO: Implement macro editing over 2 processes.
313 # TODO: Implement macro editing over 2 processes.
410 print("Macro editing not yet implemented in 2-process model.")
314 print("Macro editing not yet implemented in 2-process model.")
@@ -419,12 +323,13 b' class ZMQInteractiveShell(InteractiveShell):'
419 'filename' : filename,
323 'filename' : filename,
420 'line_number' : lineno
324 'line_number' : lineno
421 }
325 }
422 self.payload_manager.write_payload(payload)
326 self.shell.payload_manager.write_payload(payload)
423
327
424 # A few magics that are adapted to the specifics of using pexpect and a
328 # A few magics that are adapted to the specifics of using pexpect and a
425 # remote terminal
329 # remote terminal
426
330
427 def magic_clear(self, arg_s):
331 @line_magic
332 def clear(self, arg_s):
428 """Clear the terminal."""
333 """Clear the terminal."""
429 if os.name == 'posix':
334 if os.name == 'posix':
430 self.shell.system("clear")
335 self.shell.system("clear")
@@ -433,11 +338,12 b' class ZMQInteractiveShell(InteractiveShell):'
433
338
434 if os.name == 'nt':
339 if os.name == 'nt':
435 # This is the usual name in windows
340 # This is the usual name in windows
436 magic_cls = magic_clear
341 cls = line_magic('cls')(clear)
437
342
438 # Terminal pagers won't work over pexpect, but we do have our own pager
343 # Terminal pagers won't work over pexpect, but we do have our own pager
439
344
440 def magic_less(self, arg_s):
345 @line_magic
346 def less(self, arg_s):
441 """Show a file through the pager.
347 """Show a file through the pager.
442
348
443 Files ending in .py are syntax-highlighted."""
349 Files ending in .py are syntax-highlighted."""
@@ -446,25 +352,18 b' class ZMQInteractiveShell(InteractiveShell):'
446 cont = self.shell.pycolorize(cont)
352 cont = self.shell.pycolorize(cont)
447 page.page(cont)
353 page.page(cont)
448
354
449 magic_more = magic_less
355 more = line_magic('more')(less)
450
356
451 # Man calls a pager, so we also need to redefine it
357 # Man calls a pager, so we also need to redefine it
452 if os.name == 'posix':
358 if os.name == 'posix':
453 def magic_man(self, arg_s):
359 @line_magic
360 def man(self, arg_s):
454 """Find the man page for the given command and display in pager."""
361 """Find the man page for the given command and display in pager."""
455 page.page(self.shell.getoutput('man %s | col -b' % arg_s,
362 page.page(self.shell.getoutput('man %s | col -b' % arg_s,
456 split=False))
363 split=False))
457
364
458 # FIXME: this is specific to the GUI, so we should let the gui app load
365 @line_magic
459 # magics at startup that are only for the gui. Once the gui app has proper
366 def connect_info(self, arg_s):
460 # profile and configuration management, we can have it initialize a kernel
461 # with a special config file that provides these.
462 def magic_guiref(self, arg_s):
463 """Show a basic reference about the GUI console."""
464 from IPython.core.usage import gui_reference
465 page.page(gui_reference, auto_html=True)
466
467 def magic_connect_info(self, arg_s):
468 """Print information for connecting other clients to this kernel
367 """Print information for connecting other clients to this kernel
469
368
470 It will print the contents of this session's connection file, as well as
369 It will print the contents of this session's connection file, as well as
@@ -514,7 +413,8 b' class ZMQInteractiveShell(InteractiveShell):'
514 )
413 )
515 )
414 )
516
415
517 def magic_qtconsole(self, arg_s):
416 @line_magic
417 def qtconsole(self, arg_s):
518 """Open a qtconsole connected to this kernel.
418 """Open a qtconsole connected to this kernel.
519
419
520 Useful for connecting a qtconsole to running notebooks, for better
420 Useful for connecting a qtconsole to running notebooks, for better
@@ -526,6 +426,107 b' class ZMQInteractiveShell(InteractiveShell):'
526 error("Could not start qtconsole: %r" % e)
426 error("Could not start qtconsole: %r" % e)
527 return
427 return
528
428
429
430 class ZMQInteractiveShell(InteractiveShell):
431 """A subclass of InteractiveShell for ZMQ."""
432
433 displayhook_class = Type(ZMQShellDisplayHook)
434 display_pub_class = Type(ZMQDisplayPublisher)
435
436 # Override the traitlet in the parent class, because there's no point using
437 # readline for the kernel. Can be removed when the readline code is moved
438 # to the terminal frontend.
439 colors_force = CBool(True)
440 readline_use = CBool(False)
441 # autoindent has no meaning in a zmqshell, and attempting to enable it
442 # will print a warning in the absence of readline.
443 autoindent = CBool(False)
444
445 exiter = Instance(ZMQExitAutocall)
446 def _exiter_default(self):
447 return ZMQExitAutocall(self)
448
449 def _exit_now_changed(self, name, old, new):
450 """stop eventloop when exit_now fires"""
451 if new:
452 loop = ioloop.IOLoop.instance()
453 loop.add_timeout(time.time()+0.1, loop.stop)
454
455 keepkernel_on_exit = None
456
457 # Over ZeroMQ, GUI control isn't done with PyOS_InputHook as there is no
458 # interactive input being read; we provide event loop support in ipkernel
459 from .eventloops import enable_gui
460 enable_gui = staticmethod(enable_gui)
461
462 def init_environment(self):
463 """Configure the user's environment.
464
465 """
466 env = os.environ
467 # These two ensure 'ls' produces nice coloring on BSD-derived systems
468 env['TERM'] = 'xterm-color'
469 env['CLICOLOR'] = '1'
470 # Since normal pagers don't work at all (over pexpect we don't have
471 # single-key control of the subprocess), try to disable paging in
472 # subprocesses as much as possible.
473 env['PAGER'] = 'cat'
474 env['GIT_PAGER'] = 'cat'
475
476 # And install the payload version of page.
477 install_payload_page()
478
479 def auto_rewrite_input(self, cmd):
480 """Called to show the auto-rewritten input for autocall and friends.
481
482 FIXME: this payload is currently not correctly processed by the
483 frontend.
484 """
485 new = self.prompt_manager.render('rewrite') + cmd
486 payload = dict(
487 source='IPython.zmq.zmqshell.ZMQInteractiveShell.auto_rewrite_input',
488 transformed_input=new,
489 )
490 self.payload_manager.write_payload(payload)
491
492 def ask_exit(self):
493 """Engage the exit actions."""
494 self.exit_now = True
495 payload = dict(
496 source='IPython.zmq.zmqshell.ZMQInteractiveShell.ask_exit',
497 exit=True,
498 keepkernel=self.keepkernel_on_exit,
499 )
500 self.payload_manager.write_payload(payload)
501
502 def _showtraceback(self, etype, evalue, stb):
503
504 exc_content = {
505 u'traceback' : stb,
506 u'ename' : unicode(etype.__name__),
507 u'evalue' : unicode(evalue)
508 }
509
510 dh = self.displayhook
511 # Send exception info over pub socket for other clients than the caller
512 # to pick up
513 topic = None
514 if dh.topic:
515 topic = dh.topic.replace(b'pyout', b'pyerr')
516
517 exc_msg = dh.session.send(dh.pub_socket, u'pyerr', json_clean(exc_content), dh.parent_header, ident=topic)
518
519 # FIXME - Hack: store exception info in shell object. Right now, the
520 # caller is reading this info after the fact, we need to fix this logic
521 # to remove this hack. Even uglier, we need to store the error status
522 # here, because in the main loop, the logic that sets it is being
523 # skipped because runlines swallows the exceptions.
524 exc_content[u'status'] = u'error'
525 self._reply_content = exc_content
526 # /FIXME
527
528 return exc_content
529
529 def set_next_input(self, text):
530 def set_next_input(self, text):
530 """Send the specified text to the frontend to be presented at the next
531 """Send the specified text to the frontend to be presented at the next
531 input cell."""
532 input cell."""
@@ -534,6 +535,15 b' class ZMQInteractiveShell(InteractiveShell):'
534 text=text
535 text=text
535 )
536 )
536 self.payload_manager.write_payload(payload)
537 self.payload_manager.write_payload(payload)
538
539 #-------------------------------------------------------------------------
540 # Things related to magics
541 #-------------------------------------------------------------------------
542
543 def init_magics(self):
544 super(ZMQInteractiveShell, self).init_magics()
545 self.register_magics(KernelMagics)
546
537
547
538
548
539 InteractiveShellABC.register(ZMQInteractiveShell)
549 InteractiveShellABC.register(ZMQInteractiveShell)
General Comments 0
You need to be logged in to leave comments. Login now