diff --git a/IPython/html/base/zmqhandlers.py b/IPython/html/base/zmqhandlers.py index e020fdd21..8999b2672 100644 --- a/IPython/html/base/zmqhandlers.py +++ b/IPython/html/base/zmqhandlers.py @@ -3,6 +3,8 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. +import json + try: from urllib.parse import urlparse # Py 3 except ImportError: @@ -16,8 +18,6 @@ import logging from tornado import web from tornado import websocket -from zmq.utils import jsonapi - from IPython.kernel.zmq.session import Session from IPython.utils.jsonutil import date_default from IPython.utils.py3compat import PY3, cast_unicode @@ -73,7 +73,7 @@ class ZMQStreamHandler(websocket.WebSocketHandler): except KeyError: pass msg.pop('buffers') - return jsonapi.dumps(msg, default=date_default) + return json.dumps(msg, default=date_default) def _on_zmq_reply(self, msg_list): # Sometimes this gets triggered when the on_close method is scheduled in the diff --git a/IPython/html/services/clusters/handlers.py b/IPython/html/services/clusters/handlers.py index 64c94b50d..a6d6312dd 100644 --- a/IPython/html/services/clusters/handlers.py +++ b/IPython/html/services/clusters/handlers.py @@ -1,25 +1,12 @@ -"""Tornado handlers for cluster web service. +"""Tornado handlers for cluster web service.""" -Authors: +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. -* Brian Granger -""" - -#----------------------------------------------------------------------------- -# Copyright (C) 2011 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- +import json from tornado import web -from zmq.utils import jsonapi - from ...base.handlers import IPythonHandler #----------------------------------------------------------------------------- @@ -31,14 +18,14 @@ class MainClusterHandler(IPythonHandler): @web.authenticated def get(self): - self.finish(jsonapi.dumps(self.cluster_manager.list_profiles())) + self.finish(json.dumps(self.cluster_manager.list_profiles())) class ClusterProfileHandler(IPythonHandler): @web.authenticated def get(self, profile): - self.finish(jsonapi.dumps(self.cluster_manager.profile_info(profile))) + self.finish(json.dumps(self.cluster_manager.profile_info(profile))) class ClusterActionHandler(IPythonHandler): @@ -54,7 +41,7 @@ class ClusterActionHandler(IPythonHandler): data = cm.start_cluster(profile, int(n)) if action == 'stop': data = cm.stop_cluster(profile) - self.finish(jsonapi.dumps(data)) + self.finish(json.dumps(data)) #----------------------------------------------------------------------------- diff --git a/IPython/html/services/kernels/handlers.py b/IPython/html/services/kernels/handlers.py index a4361c9fb..58c23558c 100644 --- a/IPython/html/services/kernels/handlers.py +++ b/IPython/html/services/kernels/handlers.py @@ -3,11 +3,10 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. +import json import logging from tornado import web -from zmq.utils import jsonapi - from IPython.utils.jsonutil import date_default from IPython.utils.py3compat import string_types from IPython.html.utils import url_path_join, url_escape @@ -23,7 +22,7 @@ class MainKernelHandler(IPythonHandler): @json_errors def get(self): km = self.kernel_manager - self.finish(jsonapi.dumps(km.list_kernels())) + self.finish(json.dumps(km.list_kernels())) @web.authenticated @json_errors @@ -34,7 +33,7 @@ class MainKernelHandler(IPythonHandler): location = url_path_join(self.base_url, 'api', 'kernels', kernel_id) self.set_header('Location', url_escape(location)) self.set_status(201) - self.finish(jsonapi.dumps(model)) + self.finish(json.dumps(model)) class KernelHandler(IPythonHandler): @@ -47,7 +46,7 @@ class KernelHandler(IPythonHandler): km = self.kernel_manager km._check_kernel_id(kernel_id) model = km.kernel_model(kernel_id) - self.finish(jsonapi.dumps(model)) + self.finish(json.dumps(model)) @web.authenticated @json_errors @@ -71,7 +70,7 @@ class KernelActionHandler(IPythonHandler): km.restart_kernel(kernel_id) model = km.kernel_model(kernel_id) self.set_header('Location', '{0}api/kernels/{1}'.format(self.base_url, kernel_id)) - self.write(jsonapi.dumps(model)) + self.write(json.dumps(model)) self.finish() @@ -138,7 +137,7 @@ class ZMQChannelHandler(AuthenticatedZMQStreamHandler): self.zmq_stream.on_recv(self._on_zmq_reply) def on_message(self, msg): - msg = jsonapi.loads(msg) + msg = json.loads(msg) self.session.send(self.zmq_stream, msg) def on_close(self): @@ -177,7 +176,7 @@ class IOPubHandler(ZMQChannelHandler): msg = self.session.msg("status", {'execution_state': status} ) - self.write_message(jsonapi.dumps(msg, default=date_default)) + self.write_message(json.dumps(msg, default=date_default)) def on_kernel_restarted(self): logging.warn("kernel %s restarted", self.kernel_id)