##// END OF EJS Templates
json/jsonapi cleanup...
MinRK -
Show More
@@ -23,6 +23,7 b' Authors:'
23 23
24 24 from __future__ import with_statement
25 25
26 import json
26 27 import os
27 28 import socket
28 29 import stat
@@ -34,11 +35,6 b' import zmq'
34 35 from zmq.devices import ProcessMonitoredQueue
35 36 from zmq.log.handlers import PUBHandler
36 37
37 # Note: use our own import to work around jsonlib api mismatch. When these
38 # changes propagate to zmq, revert back to the following line instead:
39 #from zmq.utils import jsonapi as json
40 from IPython.zmq import jsonapi as json
41
42 38 from IPython.core.profiledir import ProfileDir
43 39
44 40 from IPython.parallel.apps.baseapp import (
@@ -214,7 +210,7 b' class IPControllerApp(BaseParallelApplication):'
214 210 location = '127.0.0.1'
215 211 cdict['location'] = location
216 212 fname = os.path.join(self.profile_dir.security_dir, fname)
217 with open(fname, 'wb') as f:
213 with open(fname, 'w') as f:
218 214 f.write(json.dumps(cdict, indent=2))
219 215 os.chmod(fname, stat.S_IRUSR|stat.S_IWUSR)
220 216
@@ -359,7 +359,9 b' class TaskScheduler(SessionFactory):'
359 359 # turn timeouts into datetime objects:
360 360 timeout = header.get('timeout', None)
361 361 if timeout:
362 timeout = datetime.now() + timedelta(0,timeout,0)
362 # cast to float, because jsonlib returns floats as decimal.Decimal,
363 # which timedelta does not accept
364 timeout = datetime.now() + timedelta(0,float(timeout),0)
363 365
364 366 args = [raw_msg, targets, after, follow, timeout]
365 367
@@ -4,6 +4,7 b' launchers.'
4 4
5 5 # Standard library imports.
6 6 import atexit
7 import json
7 8 import os
8 9 import socket
9 10 from subprocess import Popen, PIPE
@@ -12,11 +13,6 b' import tempfile'
12 13
13 14 # System library imports
14 15
15 # Note: use our own import to work around jsonlib api mismatch. When these
16 # changes propagate to zmq, revert back to the following line instead:
17 #from zmq.utils import jsonapi as json
18 from IPython.zmq import jsonapi as json
19
20 16 # IPython imports
21 17 from IPython.utils.localinterfaces import LOCALHOST
22 18 from IPython.utils.py3compat import bytes_to_str
@@ -86,7 +82,7 b' def write_connection_file(fname=None, shell_port=0, iopub_port=0, stdin_port=0, '
86 82 cfg['ip'] = ip
87 83 cfg['key'] = bytes_to_str(key)
88 84
89 with open(fname, 'wb') as f:
85 with open(fname, 'w') as f:
90 86 f.write(json.dumps(cfg, indent=2))
91 87
92 88 return fname, cfg
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now