##// 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 class InvalidPortNumber(Exception):
28 class InvalidPortNumber(Exception):
29 pass
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 class HBChannel(Thread):
31 class HBChannel(Thread):
55 """The heartbeat channel which monitors the kernel heartbeat.
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 from .channelsabc import (ChannelABC, HBChannelABC)
16 from .channelsabc import (ChannelABC, HBChannelABC)
17 from .channels import (
18 make_shell_socket, make_stdin_socket, make_iopub_socket
19 )
20 from .clientabc import KernelClientABC
17 from .clientabc import KernelClientABC
21 from .connect import ConnectionFileMixin
18 from .connect import ConnectionFileMixin
22
19
@@ -144,7 +141,7 b' class KernelClient(ConnectionFileMixin):'
144 if self._shell_channel is None:
141 if self._shell_channel is None:
145 url = self._make_url('shell')
142 url = self._make_url('shell')
146 self.log.debug("connecting shell channel to %s", url)
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 self._shell_channel = self.shell_channel_class(
145 self._shell_channel = self.shell_channel_class(
149 socket, self.session, self.ioloop
146 socket, self.session, self.ioloop
150 )
147 )
@@ -156,7 +153,7 b' class KernelClient(ConnectionFileMixin):'
156 if self._iopub_channel is None:
153 if self._iopub_channel is None:
157 url = self._make_url('iopub')
154 url = self._make_url('iopub')
158 self.log.debug("connecting iopub channel to %s", url)
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 self._iopub_channel = self.iopub_channel_class(
157 self._iopub_channel = self.iopub_channel_class(
161 socket, self.session, self.ioloop
158 socket, self.session, self.ioloop
162 )
159 )
@@ -168,7 +165,7 b' class KernelClient(ConnectionFileMixin):'
168 if self._stdin_channel is None:
165 if self._stdin_channel is None:
169 url = self._make_url('stdin')
166 url = self._make_url('stdin')
170 self.log.debug("connecting stdin channel to %s", url)
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 self._stdin_channel = self.stdin_channel_class(
169 self._stdin_channel = self.stdin_channel_class(
173 socket, self.session, self.ioloop
170 socket, self.session, self.ioloop
174 )
171 )
@@ -15,8 +15,7 b' from IPython.external.qt import QtCore'
15
15
16 # Local imports
16 # Local imports
17 from IPython.utils.traitlets import Type, Instance
17 from IPython.utils.traitlets import Type, Instance
18 from IPython.kernel.channels import HBChannel,\
18 from IPython.kernel.channels import HBChannel
19 make_shell_socket, make_iopub_socket, make_stdin_socket
20 from IPython.kernel import KernelClient
19 from IPython.kernel import KernelClient
21
20
22 from .kernel_mixins import QtKernelClientMixin
21 from .kernel_mixins import QtKernelClientMixin
General Comments 0
You need to be logged in to leave comments. Login now