##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r13385:7ca41d13
r18639:28c27a69
Show More
socket.py
65 lines | 2.3 KiB | text/x-python | PythonLexer
epatters
Implement EmbeddedKernel.
r8411 """ Defines a dummy socket implementing (part of) the zmq.Socket interface. """
#-----------------------------------------------------------------------------
# Copyright (C) 2012 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
#-----------------------------------------------------------------------------
# Standard library imports.
epatters
Add abstract base class (ABC) for sockets used in kernel.
r8418 import abc
Thomas Kluyver
Update imports for Python 3...
r13354 try:
from queue import Queue # Py 3
except ImportError:
from Queue import Queue # Py 2
epatters
Implement EmbeddedKernel.
r8411
# System library imports.
import zmq
# Local imports.
from IPython.utils.traitlets import HasTraits, Instance, Int
Thomas Kluyver
Fixes for metaclass syntax
r13359 from IPython.utils.py3compat import with_metaclass
epatters
Implement EmbeddedKernel.
r8411
#-----------------------------------------------------------------------------
epatters
Add abstract base class (ABC) for sockets used in kernel.
r8418 # Generic socket interface
#-----------------------------------------------------------------------------
Thomas Kluyver
Fixes for metaclass syntax
r13359 class SocketABC(with_metaclass(abc.ABCMeta, object)):
epatters
Add abstract base class (ABC) for sockets used in kernel.
r8418 @abc.abstractmethod
def recv_multipart(self, flags=0, copy=True, track=False):
raise NotImplementedError
@abc.abstractmethod
def send_multipart(self, msg_parts, flags=0, copy=True, track=False):
raise NotImplementedError
SocketABC.register(zmq.Socket)
#-----------------------------------------------------------------------------
epatters
Implement EmbeddedKernel.
r8411 # Dummy socket class
#-----------------------------------------------------------------------------
class DummySocket(HasTraits):
""" A dummy socket implementing (part of) the zmq.Socket interface. """
Thomas Kluyver
Update imports for Python 3...
r13354 queue = Instance(Queue, ())
epatters
Implement EmbeddedKernel.
r8411 message_sent = Int(0) # Should be an Event
#-------------------------------------------------------------------------
epatters
Add abstract base class (ABC) for sockets used in kernel.
r8418 # Socket interface
epatters
Implement EmbeddedKernel.
r8411 #-------------------------------------------------------------------------
def recv_multipart(self, flags=0, copy=True, track=False):
return self.queue.get_nowait()
def send_multipart(self, msg_parts, flags=0, copy=True, track=False):
Thomas Kluyver
Fix kernel.inprocess tests
r13385 msg_parts = list(map(zmq.Message, msg_parts))
epatters
Implement EmbeddedKernel.
r8411 self.queue.put_nowait(msg_parts)
self.message_sent += 1
epatters
Add abstract base class (ABC) for sockets used in kernel.
r8418
SocketABC.register(DummySocket)