##// END OF EJS Templates
Remove redundant make_*_socket functions
Thomas Kluyver -
Show More
@@ -28,29 +28,6 b' major_protocol_version = kernel_protocol_version_info[0]'
28 28 class InvalidPortNumber(Exception):
29 29 pass
30 30
31
32 def make_shell_socket(context, identity, address):
33 socket = context.socket(zmq.DEALER)
34 socket.linger = 1000
35 socket.identity = identity
36 socket.connect(address)
37 return socket
38
39 def make_iopub_socket(context, identity, address):
40 socket = context.socket(zmq.SUB)
41 socket.linger = 1000
42 socket.subscribe = b''
43 socket.identity = identity
44 socket.connect(address)
45 return socket
46
47 def make_stdin_socket(context, identity, address):
48 socket = context.socket(zmq.DEALER)
49 socket.linger = 1000
50 socket.identity = identity
51 socket.connect(address)
52 return socket
53
54 31 class HBChannel(Thread):
55 32 """The heartbeat channel which monitors the kernel heartbeat.
56 33
@@ -14,9 +14,6 b' from IPython.utils.traitlets import ('
14 14 )
15 15
16 16 from .channelsabc import (ChannelABC, HBChannelABC)
17 from .channels import (
18 make_shell_socket, make_stdin_socket, make_iopub_socket
19 )
20 17 from .clientabc import KernelClientABC
21 18 from .connect import ConnectionFileMixin
22 19
@@ -144,7 +141,7 b' class KernelClient(ConnectionFileMixin):'
144 141 if self._shell_channel is None:
145 142 url = self._make_url('shell')
146 143 self.log.debug("connecting shell channel to %s", url)
147 socket = make_shell_socket(self.context, self.session.bsession, url)
144 socket = self.connect_shell(identity=self.session.bsession)
148 145 self._shell_channel = self.shell_channel_class(
149 146 socket, self.session, self.ioloop
150 147 )
@@ -156,7 +153,7 b' class KernelClient(ConnectionFileMixin):'
156 153 if self._iopub_channel is None:
157 154 url = self._make_url('iopub')
158 155 self.log.debug("connecting iopub channel to %s", url)
159 socket = make_iopub_socket(self.context, self.session.bsession, url)
156 socket = self.connect_iopub()
160 157 self._iopub_channel = self.iopub_channel_class(
161 158 socket, self.session, self.ioloop
162 159 )
@@ -168,7 +165,7 b' class KernelClient(ConnectionFileMixin):'
168 165 if self._stdin_channel is None:
169 166 url = self._make_url('stdin')
170 167 self.log.debug("connecting stdin channel to %s", url)
171 socket = make_stdin_socket(self.context, self.session.bsession, url)
168 socket = self.connect_stdin(identity=self.session.bsession)
172 169 self._stdin_channel = self.stdin_channel_class(
173 170 socket, self.session, self.ioloop
174 171 )
@@ -15,8 +15,7 b' from IPython.external.qt import QtCore'
15 15
16 16 # Local imports
17 17 from IPython.utils.traitlets import Type, Instance
18 from IPython.kernel.channels import HBChannel,\
19 make_shell_socket, make_iopub_socket, make_stdin_socket
18 from IPython.kernel.channels import HBChannel
20 19 from IPython.kernel import KernelClient
21 20
22 21 from .kernel_mixins import QtKernelClientMixin
General Comments 0
You need to be logged in to leave comments. Login now