##// END OF EJS Templates
More Python 3 compatibility fixes.
Thomas Kluyver -
Show More
@@ -16,6 +16,7 b' from types import ModuleType'
16 16 from IPython.parallel.client.asyncresult import AsyncResult
17 17 from IPython.parallel.error import UnmetDependency
18 18 from IPython.parallel.util import interactive
19 from IPython.utils import py3compat
19 20
20 21 class depend(object):
21 22 """Dependency decorator, for use with tasks.
@@ -65,6 +66,7 b' class dependent(object):'
65 66 raise UnmetDependency()
66 67 return self.f(*args, **kwargs)
67 68
69 if not py3compat.PY3:
68 70 @property
69 71 def __name__(self):
70 72 return self.func_name
@@ -188,7 +188,7 b' class ShellSocketChannel(ZMQSocketChannel):'
188 188 def run(self):
189 189 """The thread's main activity. Call start() instead."""
190 190 self.socket = self.context.socket(zmq.DEALER)
191 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
191 self.socket.setsockopt(zmq.IDENTITY, self.session.session.encode("ascii"))
192 192 self.socket.connect('tcp://%s:%i' % self.address)
193 193 self.iostate = POLLERR|POLLIN
194 194 self.ioloop.add_handler(self.socket, self._handle_events,
@@ -394,8 +394,8 b' class SubSocketChannel(ZMQSocketChannel):'
394 394 def run(self):
395 395 """The thread's main activity. Call start() instead."""
396 396 self.socket = self.context.socket(zmq.SUB)
397 self.socket.setsockopt(zmq.SUBSCRIBE,'')
398 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
397 self.socket.setsockopt(zmq.SUBSCRIBE,b'')
398 self.socket.setsockopt(zmq.IDENTITY, self.session.session.encode("ascii"))
399 399 self.socket.connect('tcp://%s:%i' % self.address)
400 400 self.iostate = POLLIN|POLLERR
401 401 self.ioloop.add_handler(self.socket, self._handle_events,
@@ -483,7 +483,7 b' class StdInSocketChannel(ZMQSocketChannel):'
483 483 def run(self):
484 484 """The thread's main activity. Call start() instead."""
485 485 self.socket = self.context.socket(zmq.DEALER)
486 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
486 self.socket.setsockopt(zmq.IDENTITY, self.session.session.encode("ascii"))
487 487 self.socket.connect('tcp://%s:%i' % self.address)
488 488 self.iostate = POLLERR|POLLIN
489 489 self.ioloop.add_handler(self.socket, self._handle_events,
@@ -562,7 +562,7 b' class HBSocketChannel(ZMQSocketChannel):'
562 562
563 563 def _create_socket(self):
564 564 self.socket = self.context.socket(zmq.REQ)
565 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
565 self.socket.setsockopt(zmq.IDENTITY, self.session.session.encode("ascii"))
566 566 self.socket.connect('tcp://%s:%i' % self.address)
567 567 self.poller = zmq.Poller()
568 568 self.poller.register(self.socket, zmq.POLLIN)
@@ -48,7 +48,7 b' from IPython.utils.importstring import import_item'
48 48 from IPython.utils.jsonutil import extract_dates, squash_dates, date_default
49 49 from IPython.utils.py3compat import str_to_bytes
50 50 from IPython.utils.traitlets import (CBytes, Unicode, Bool, Any, Instance, Set,
51 DottedObjectName)
51 DottedObjectName, CUnicode)
52 52
53 53 #-----------------------------------------------------------------------------
54 54 # utility functions
@@ -239,10 +239,10 b' class Session(Configurable):'
239 239 else:
240 240 self.unpack = import_item(str(new))
241 241
242 session = CBytes(b'', config=True,
242 session = CUnicode(u'', config=True,
243 243 help="""The UUID identifying this session.""")
244 244 def _session_default(self):
245 return bytes(uuid.uuid4())
245 return unicode(uuid.uuid4())
246 246
247 247 username = Unicode(os.environ.get('USER',u'username'), config=True,
248 248 help="""Username for the Session. Default is your system username.""")
General Comments 0
You need to be logged in to leave comments. Login now