Permalink
Browse files

cleanup channel names to match function not socket

closes gh-178
  • Loading branch information...
1 parent a3fc5dc commit 7940e2fd73db1fde65596faf6032ae2d46ace2a5 @minrk minrk committed Jun 1, 2011
@@ -30,8 +30,8 @@ def _set_kernel_manager(self, kernel_manager):
# Disconnect the old kernel manager's channels.
old_manager.sub_channel.message_received.disconnect(self._dispatch)
- old_manager.xreq_channel.message_received.disconnect(self._dispatch)
- old_manager.rep_channel.message_received.disconnect(self._dispatch)
+ old_manager.shell_channel.message_received.disconnect(self._dispatch)
+ old_manager.stdin_channel.message_received.disconnect(self._dispatch)
old_manager.hb_channel.kernel_died.disconnect(
self._handle_kernel_died)
@@ -50,8 +50,8 @@ def _set_kernel_manager(self, kernel_manager):
# Connect the new kernel manager's channels.
kernel_manager.sub_channel.message_received.connect(self._dispatch)
- kernel_manager.xreq_channel.message_received.connect(self._dispatch)
- kernel_manager.rep_channel.message_received.connect(self._dispatch)
+ kernel_manager.shell_channel.message_received.connect(self._dispatch)
+ kernel_manager.stdin_channel.message_received.connect(self._dispatch)
kernel_manager.hb_channel.kernel_died.connect(self._handle_kernel_died)
# Handle the case where the kernel manager started channels before
@@ -184,7 +184,7 @@ def _execute(self, source, hidden):
See parent class :meth:`execute` docstring for full details.
"""
- msg_id = self.kernel_manager.xreq_channel.execute(source, hidden)
+ msg_id = self.kernel_manager.shell_channel.execute(source, hidden)
self._request_info['execute'] = self._ExecutionRequest(msg_id, 'user')
self._hidden = hidden
if not hidden:
@@ -330,7 +330,7 @@ def _handle_input_request(self, msg):
self.kernel_manager.sub_channel.flush()
def callback(line):
- self.kernel_manager.rep_channel.input(line)
+ self.kernel_manager.stdin_channel.input(line)
self._readline(msg['content']['prompt'], callback=callback)
def _handle_kernel_died(self, since_last_heartbeat):
@@ -518,7 +518,7 @@ def _call_tip(self):
# Send the metadata request to the kernel
name = '.'.join(context)
- msg_id = self.kernel_manager.xreq_channel.object_info(name)
+ msg_id = self.kernel_manager.shell_channel.object_info(name)
pos = self._get_cursor().position()
self._request_info['call_tip'] = self._CallTipRequest(msg_id, pos)
return True
@@ -529,7 +529,7 @@ def _complete(self):
context = self._get_context()
if context:
# Send the completion request to the kernel
- msg_id = self.kernel_manager.xreq_channel.complete(
+ msg_id = self.kernel_manager.shell_channel.complete(
'.'.join(context), # text
self._get_input_buffer_cursor_line(), # line
self._get_input_buffer_cursor_column(), # cursor_pos
@@ -222,7 +222,7 @@ def _started_channels(self):
""" Reimplemented to make a history request.
"""
super(IPythonWidget, self)._started_channels()
- self.kernel_manager.xreq_channel.history(hist_access_type='tail', n=1000)
+ self.kernel_manager.shell_channel.history(hist_access_type='tail', n=1000)
#---------------------------------------------------------------------------
# 'ConsoleWidget' public interface
@@ -264,7 +264,7 @@ def _complete(self):
text = ''
# Send the completion request to the kernel
- msg_id = self.kernel_manager.xreq_channel.complete(
+ msg_id = self.kernel_manager.shell_channel.complete(
text, # text
self._get_input_buffer_cursor_line(), # line
self._get_input_buffer_cursor_column(), # cursor_pos
@@ -315,7 +315,7 @@ def _show_interpreter_prompt(self, number=None):
"""
# If a number was not specified, make a prompt number request.
if number is None:
- msg_id = self.kernel_manager.xreq_channel.execute('', silent=True)
+ msg_id = self.kernel_manager.shell_channel.execute('', silent=True)
info = self._ExecutionRequest(msg_id, 'prompt')
self._request_info['execute'] = info
return
@@ -257,9 +257,9 @@ def init_kernel_manager(self):
# Create a KernelManager and start a kernel.
self.kernel_manager = QtKernelManager(
- xreq_address=(self.ip, self.shell_port),
+ shell_address=(self.ip, self.shell_port),
sub_address=(self.ip, self.iopub_port),
- rep_address=(self.ip, self.stdin_port),
+ stdin_address=(self.ip, self.stdin_port),
hb_address=(self.ip, self.hb_port)
)
# start the kernel
@@ -7,7 +7,7 @@
# IPython imports.
from IPython.utils.traitlets import Type
from IPython.zmq.kernelmanager import KernelManager, SubSocketChannel, \
- XReqSocketChannel, RepSocketChannel, HBSocketChannel
+ ShellSocketChannel, StdInSocketChannel, HBSocketChannel
from util import MetaQObjectHasTraits, SuperQObject
@@ -20,7 +20,7 @@ class SocketChannelQObject(SuperQObject):
stopped = QtCore.Signal()
#---------------------------------------------------------------------------
- # 'ZmqSocketChannel' interface
+ # 'ZMQSocketChannel' interface
#---------------------------------------------------------------------------
def start(self):
@@ -36,7 +36,7 @@ def stop(self):
self.stopped.emit()
-class QtXReqSocketChannel(SocketChannelQObject, XReqSocketChannel):
+class QtShellSocketChannel(SocketChannelQObject, ShellSocketChannel):
# Emitted when any message is received.
message_received = QtCore.Signal(object)
@@ -56,7 +56,7 @@ class QtXReqSocketChannel(SocketChannelQObject, XReqSocketChannel):
_handlers_called = False
#---------------------------------------------------------------------------
- # 'XReqSocketChannel' interface
+ # 'ShellSocketChannel' interface
#---------------------------------------------------------------------------
def call_handlers(self, msg):
@@ -76,7 +76,7 @@ def call_handlers(self, msg):
self._handlers_called = True
#---------------------------------------------------------------------------
- # 'QtXReqSocketChannel' interface
+ # 'QtShellSocketChannel' interface
#---------------------------------------------------------------------------
def reset_first_reply(self):
@@ -136,7 +136,7 @@ def flush(self):
QtCore.QCoreApplication.instance().processEvents()
-class QtRepSocketChannel(SocketChannelQObject, RepSocketChannel):
+class QtStdInSocketChannel(SocketChannelQObject, StdInSocketChannel):
# Emitted when any message is received.
message_received = QtCore.Signal(object)
@@ -145,7 +145,7 @@ class QtRepSocketChannel(SocketChannelQObject, RepSocketChannel):
input_requested = QtCore.Signal(object)
#---------------------------------------------------------------------------
- # 'RepSocketChannel' interface
+ # 'StdInSocketChannel' interface
#---------------------------------------------------------------------------
def call_handlers(self, msg):
@@ -190,8 +190,8 @@ class QtKernelManager(KernelManager, SuperQObject):
# Use Qt-specific channel classes that emit signals.
sub_channel_class = Type(QtSubSocketChannel)
- xreq_channel_class = Type(QtXReqSocketChannel)
- rep_channel_class = Type(QtRepSocketChannel)
+ shell_channel_class = Type(QtShellSocketChannel)
+ stdin_channel_class = Type(QtStdInSocketChannel)
hb_channel_class = Type(QtHBSocketChannel)
#---------------------------------------------------------------------------
@@ -203,8 +203,8 @@ class QtKernelManager(KernelManager, SuperQObject):
def start_kernel(self, *args, **kw):
""" Reimplemented for proper heartbeat management.
"""
- if self._xreq_channel is not None:
- self._xreq_channel.reset_first_reply()
+ if self._shell_channel is not None:
+ self._shell_channel.reset_first_reply()
super(QtKernelManager, self).start_kernel(*args, **kw)
#------ Channel management -------------------------------------------------
@@ -222,13 +222,13 @@ def stop_channels(self):
self.stopped_channels.emit()
@property
- def xreq_channel(self):
+ def shell_channel(self):
""" Reimplemented for proper heartbeat management.
"""
- if self._xreq_channel is None:
- self._xreq_channel = super(QtKernelManager, self).xreq_channel
- self._xreq_channel.first_reply.connect(self._first_reply)
- return self._xreq_channel
+ if self._shell_channel is None:
+ self._shell_channel = super(QtKernelManager, self).shell_channel
+ self._shell_channel.first_reply.connect(self._first_reply)
+ return self._shell_channel
#---------------------------------------------------------------------------
# Protected interface
@@ -21,8 +21,8 @@
from IPython.utils import io
from IPython.utils.traitlets import Type
-from .kernelmanager import (KernelManager, SubSocketChannel,
- XReqSocketChannel, RepSocketChannel, HBSocketChannel)
+from .kernelmanager import (KernelManager, SubSocketChannel, HBSocketChannel,
+ ShellSocketChannel, StdInSocketChannel)
#-----------------------------------------------------------------------------
# Functions and classes
@@ -61,15 +61,15 @@ def get_msgs(self):
return msgs
-class BlockingXReqSocketChannel(XReqSocketChannel):
+class BlockingShellSocketChannel(ShellSocketChannel):
def __init__(self, context, session, address=None):
- super(BlockingXReqSocketChannel, self).__init__(context, session,
+ super(BlockingShellSocketChannel, self).__init__(context, session,
address)
self._in_queue = Queue()
def call_handlers(self, msg):
- #io.rprint('[[XReq]]', msg) # dbg
+ #io.rprint('[[Shell]]', msg) # dbg
self._in_queue.put(msg)
def msg_ready(self):
@@ -94,7 +94,7 @@ def get_msgs(self):
return msgs
-class BlockingRepSocketChannel(RepSocketChannel):
+class BlockingStdInSocketChannel(StdInSocketChannel):
def call_handlers(self, msg):
#io.rprint('[[Rep]]', msg) # dbg
@@ -114,8 +114,8 @@ def call_handlers(self, since_last_heartbeat):
class BlockingKernelManager(KernelManager):
# The classes to use for the various channels.
- xreq_channel_class = Type(BlockingXReqSocketChannel)
+ shell_channel_class = Type(BlockingShellSocketChannel)
sub_channel_class = Type(BlockingSubSocketChannel)
- rep_channel_class = Type(BlockingRepSocketChannel)
+ stdin_channel_class = Type(BlockingStdInSocketChannel)
hb_channel_class = Type(BlockingHBSocketChannel)
Oops, something went wrong.

0 comments on commit 7940e2f

Please sign in to comment.