fix swi call leak
improve yapi reformat
This commit is contained in:
@@ -1,53 +1,53 @@
|
||||
|
||||
set (EXTRAS
|
||||
MANIFEST.in
|
||||
YAP_KERNEL.md
|
||||
)
|
||||
MANIFEST.in
|
||||
YAP_KERNEL.md
|
||||
)
|
||||
|
||||
set (PYTHON_SOURCES
|
||||
yap_kernel_launcher.py
|
||||
data_kernelspec/kernel.json
|
||||
yap_kernel/__init__.py
|
||||
yap_kernel/__main__.py
|
||||
yap_kernel/_version.py
|
||||
yap_kernel/codeutil.py
|
||||
yap_kernel/connect.py
|
||||
yap_kernel_launcher.py
|
||||
data_kernelspec/kernel.json
|
||||
yap_kernel/__init__.py
|
||||
yap_kernel/__main__.py
|
||||
yap_kernel/_version.py
|
||||
yap_kernel/codeutil.py
|
||||
yap_kernel/connect.py
|
||||
yap_kernel/datapub.py
|
||||
yap_kernel/displayhook.py
|
||||
yap_kernel/embed.py
|
||||
yap_kernel/eventloops.py
|
||||
yap_kernel/heartbeat.py
|
||||
yap_kernel/interactiveshell.py
|
||||
yap_kernel/iostream.py
|
||||
yap_kernel/jsonutil.py
|
||||
yap_kernel/kernelapp.py
|
||||
yap_kernel/kernelbase.py
|
||||
yap_kernel/kernelspec.py
|
||||
yap_kernel/log.py
|
||||
yap_kernel/parentpoller.py
|
||||
yap_kernel/pickleutil.py
|
||||
yap_kernel/serialize.py
|
||||
yap_kernel/yapkernel.py
|
||||
yap_kernel/zmqshell.py
|
||||
yap_kernel/comm/__init__.py
|
||||
yap_kernel/comm/comm.py
|
||||
yap_kernel/comm/manager.py
|
||||
yap_kernel/gui/__init__.py
|
||||
yap_kernel/gui/gtk3embed.py
|
||||
yap_kernel/gui/gtkembed.py
|
||||
yap_kernel/inprocess/__init__.py
|
||||
yap_kernel/inprocess/blocking.py
|
||||
yap_kernel/inprocess/channels.py
|
||||
yap_kernel/inprocess/client.py
|
||||
yap_kernel/inprocess/ipkernel.py
|
||||
yap_kernel/inprocess/manager.py
|
||||
yap_kernel/inprocess/socket.py
|
||||
yap_kernel/pylab/__init__.py
|
||||
yap_kernel/pylab/backend_inline.py
|
||||
yap_kernel/pylab/config.py
|
||||
)
|
||||
yap_kernel/displayhook.py
|
||||
yap_kernel/embed.py
|
||||
yap_kernel/eventloops.py
|
||||
yap_kernel/heartbeat.py
|
||||
yap_kernel/interactiveshell.py
|
||||
yap_kernel/iostream.py
|
||||
yap_kernel/jsonutil.py
|
||||
yap_kernel/kernelapp.py
|
||||
yap_kernel/kernelbase.py
|
||||
yap_kernel/kernelspec.py
|
||||
yap_kernel/log.py
|
||||
yap_kernel/parentpoller.py
|
||||
yap_kernel/pickleutil.py
|
||||
yap_kernel/serialize.py
|
||||
yap_kernel/yapkernel.py
|
||||
yap_kernel/zmqshell.py
|
||||
yap_kernel/comm/__init__.py
|
||||
yap_kernel/comm/comm.py
|
||||
yap_kernel/comm/manager.py
|
||||
yap_kernel/gui/__init__.py
|
||||
yap_kernel/gui/gtk3embed.py
|
||||
yap_kernel/gui/gtkembed.py
|
||||
yap_kernel/inprocess/__init__.py
|
||||
yap_kernel/inprocess/blocking.py
|
||||
yap_kernel/inprocess/channels.py
|
||||
yap_kernel/inprocess/client.py
|
||||
yap_kernel/inprocess/ipkernel.py
|
||||
yap_kernel/inprocess/manager.py
|
||||
yap_kernel/inprocess/socket.py
|
||||
yap_kernel/pylab/__init__.py
|
||||
yap_kernel/pylab/backend_inline.py
|
||||
yap_kernel/pylab/config.py
|
||||
)
|
||||
|
||||
configure_file(setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||
configure_file(setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/yap_kernel/resources)
|
||||
file(COPY yap_kernel DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@@ -61,12 +61,12 @@
|
||||
set(SETUP_PY ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||
|
||||
add_custom_target( YAPKernel ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} sdist
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} sdist
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --no-index -f dist yap_kernel
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
||||
|
||||
# install(FILES jupyter.yap
|
||||
# DESTINATION ${libpl} )
|
||||
# install(FILES jupyter.yap
|
||||
# DESTINATION ${libpl} )
|
||||
|
@@ -28,6 +28,7 @@ from internal_yapkernel import InternalYAPKernel
|
||||
class SimpleWindow(Qt.QWidget, InternalYAPKernel):
|
||||
|
||||
def __init__(self, app):
|
||||
# type: (object) -> object
|
||||
Qt.QWidget.__init__(self)
|
||||
self.app = app
|
||||
self.add_widgets()
|
||||
|
@@ -36,6 +36,7 @@ class MyFrame(wx.Frame, InternalYAPKernel):
|
||||
"""
|
||||
|
||||
def __init__(self, parent, title):
|
||||
# type: (object, object) -> object
|
||||
wx.Frame.__init__(self, parent, -1, title,
|
||||
pos=(150, 150), size=(350, 285))
|
||||
|
||||
|
@@ -85,10 +85,6 @@ if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
|
||||
|
||||
setuptools_args = {}
|
||||
install_requires = setuptools_args['install_requires'] = [
|
||||
'ipython>=4.0.0',
|
||||
'traitlets>=4.1.0',
|
||||
'jupyter_client',
|
||||
'tornado>=4.0',
|
||||
]
|
||||
|
||||
if any(a.startswith(('bdist', 'build', 'install')) for a in sys.argv):
|
||||
|
@@ -48,6 +48,7 @@ class Comm(LoggingConfigurable):
|
||||
_closed = Bool(True)
|
||||
|
||||
def __init__(self, target_name='', data=None, metadata=None, buffers=None, **kwargs):
|
||||
# type: (object, object, object, object, object) -> object
|
||||
if target_name:
|
||||
kwargs['target_name'] = target_name
|
||||
super(Comm, self).__init__(**kwargs)
|
||||
|
@@ -18,6 +18,7 @@ class ZMQDisplayHook(object):
|
||||
topic = b'execute_result'
|
||||
|
||||
def __init__(self, session, pub_socket):
|
||||
# type: (object, object) -> object
|
||||
self.session = session
|
||||
self.pub_socket = pub_socket
|
||||
self.parent_header = {}
|
||||
|
@@ -138,6 +138,7 @@ def loop_wx(kernel):
|
||||
# We make the Frame hidden when we create it in the main app below.
|
||||
class TimerFrame(wx.Frame):
|
||||
def __init__(self, func):
|
||||
# type: (object) -> object
|
||||
wx.Frame.__init__(self, None, -1)
|
||||
self.timer = wx.Timer(self)
|
||||
# Units for the timer are in milliseconds
|
||||
@@ -184,6 +185,7 @@ def loop_tk(kernel):
|
||||
# For Tkinter, we create a Tk object and call its withdraw method.
|
||||
class Timer(object):
|
||||
def __init__(self, func):
|
||||
# type: (object) -> object
|
||||
self.app = Tk()
|
||||
self.app.withdraw()
|
||||
self.func = func
|
||||
|
@@ -27,6 +27,7 @@ class GTKEmbed(object):
|
||||
"""A class to embed a kernel into the GTK main event loop.
|
||||
"""
|
||||
def __init__(self, kernel):
|
||||
# type: (object) -> object
|
||||
self.kernel = kernel
|
||||
# These two will later store the real gtk functions when we hijack them
|
||||
self.gtk_main = None
|
||||
|
@@ -25,6 +25,7 @@ class GTKEmbed(object):
|
||||
"""A class to embed a kernel into the GTK main event loop.
|
||||
"""
|
||||
def __init__(self, kernel):
|
||||
# type: (object) -> object
|
||||
self.kernel = kernel
|
||||
# These two will later store the real gtk functions when we hijack them
|
||||
self.gtk_main = None
|
||||
|
@@ -30,6 +30,7 @@ class Heartbeat(Thread):
|
||||
"A simple ping-pong style heartbeat that runs in a thread."
|
||||
|
||||
def __init__(self, context, addr=None):
|
||||
# type: (object, object) -> object
|
||||
if addr is None:
|
||||
addr = ('tcp', localhost(), 0)
|
||||
Thread.__init__(self)
|
||||
|
@@ -27,6 +27,7 @@ from .client import InProcessKernelClient
|
||||
class BlockingInProcessChannel(InProcessChannel):
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
# type: (object, object) -> object
|
||||
super(BlockingInProcessChannel, self).__init__(*args, **kwds)
|
||||
self._in_queue = Queue()
|
||||
|
||||
|
@@ -16,6 +16,7 @@ class InProcessChannel(object):
|
||||
proxy_methods = []
|
||||
|
||||
def __init__(self, client=None):
|
||||
# type: (object) -> object
|
||||
super(InProcessChannel, self).__init__()
|
||||
self.client = client
|
||||
self._is_alive = False
|
||||
@@ -70,6 +71,7 @@ class InProcessHBChannel(object):
|
||||
time_to_dead = 3.0
|
||||
|
||||
def __init__(self, client=None):
|
||||
# type: (object) -> object
|
||||
super(InProcessHBChannel, self).__init__()
|
||||
self.client = client
|
||||
self._is_alive = False
|
||||
|
@@ -70,6 +70,7 @@ class InProcessKernel(YAPKernel):
|
||||
stdin_socket = Instance(DummySocket, ())
|
||||
|
||||
def __init__(self, **traits):
|
||||
# type: (object) -> object
|
||||
super(InProcessKernel, self).__init__(**traits)
|
||||
|
||||
self._underlying_iopub_socket.observe(self._io_dispatch, names=['message_sent'])
|
||||
|
@@ -98,6 +98,7 @@ class YAPInteraction:
|
||||
"""An enhanced, interactive shell for YAP."""
|
||||
|
||||
def __init__(self, shell, **kwargs):
|
||||
# type: (object, object) -> object
|
||||
try:
|
||||
if self.yapeng:
|
||||
return
|
||||
|
@@ -43,6 +43,7 @@ class IOPubThread(object):
|
||||
"""
|
||||
|
||||
def __init__(self, socket, pipe=False):
|
||||
# type: (object, object) -> object
|
||||
"""Create IOPub thread
|
||||
|
||||
Parameters
|
||||
@@ -220,6 +221,7 @@ class BackgroundSocket(object):
|
||||
io_thread = None
|
||||
|
||||
def __init__(self, io_thread):
|
||||
# type: (object) -> object
|
||||
self.io_thread = io_thread
|
||||
|
||||
def __getattr__(self, attr):
|
||||
@@ -261,6 +263,7 @@ class OutStream(TextIOBase):
|
||||
encoding = 'UTF-8'
|
||||
|
||||
def __init__(self, session, pub_thread, name, pipe=None):
|
||||
# type: (object, object, object, object) -> object
|
||||
if pipe is not None:
|
||||
warnings.warn("pipe argument to OutStream is deprecated and ignored",
|
||||
DeprecationWarning)
|
||||
|
@@ -134,6 +134,7 @@ class Kernel(SingletonConfigurable):
|
||||
control_msg_types = msg_types + ['clear_request', 'abort_request']
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# type: (object) -> object
|
||||
super(Kernel, self).__init__(**kwargs)
|
||||
|
||||
# Build dict of handlers for message types
|
||||
|
@@ -10,6 +10,7 @@ class EnginePUBHandler(PUBHandler):
|
||||
engine=None
|
||||
|
||||
def __init__(self, engine, *args, **kwargs):
|
||||
# type: (object, object, object) -> object
|
||||
PUBHandler.__init__(self,*args, **kwargs)
|
||||
self.engine = engine
|
||||
|
||||
|
@@ -25,6 +25,7 @@ class ParentPollerUnix(Thread):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# type: () -> object
|
||||
super(ParentPollerUnix, self).__init__()
|
||||
self.daemon = True
|
||||
|
||||
@@ -50,6 +51,7 @@ class ParentPollerWindows(Thread):
|
||||
"""
|
||||
|
||||
def __init__(self, interrupt_handle=None, parent_handle=None):
|
||||
# type: (object, object) -> object
|
||||
""" Create the poller. At least one of the optional parameters must be
|
||||
provided.
|
||||
|
||||
|
@@ -127,6 +127,7 @@ def use_cloudpickle():
|
||||
|
||||
class CannedObject(object):
|
||||
def __init__(self, obj, keys=[], hook=None):
|
||||
# type: (object, object, object) -> object
|
||||
"""can an object for safe pickling
|
||||
|
||||
Parameters
|
||||
@@ -167,6 +168,7 @@ class CannedObject(object):
|
||||
class Reference(CannedObject):
|
||||
"""object for wrapping a remote reference by name."""
|
||||
def __init__(self, name):
|
||||
# type: (object) -> object
|
||||
if not isinstance(name, string_types):
|
||||
raise TypeError("illegal name: %r"%name)
|
||||
self.name = name
|
||||
@@ -185,6 +187,7 @@ class Reference(CannedObject):
|
||||
class CannedCell(CannedObject):
|
||||
"""Can a closure cell"""
|
||||
def __init__(self, cell):
|
||||
# type: (object) -> object
|
||||
self.cell_contents = can(cell.cell_contents)
|
||||
|
||||
def get_object(self, g=None):
|
||||
@@ -197,6 +200,7 @@ class CannedCell(CannedObject):
|
||||
class CannedFunction(CannedObject):
|
||||
|
||||
def __init__(self, f):
|
||||
# type: (object) -> object
|
||||
self._check_type(f)
|
||||
self.code = f.__code__
|
||||
if f.__defaults__:
|
||||
@@ -239,6 +243,7 @@ class CannedFunction(CannedObject):
|
||||
class CannedClass(CannedObject):
|
||||
|
||||
def __init__(self, cls):
|
||||
# type: (object) -> object
|
||||
self._check_type(cls)
|
||||
self.name = cls.__name__
|
||||
self.old_style = not isinstance(cls, type)
|
||||
@@ -263,6 +268,7 @@ class CannedClass(CannedObject):
|
||||
|
||||
class CannedArray(CannedObject):
|
||||
def __init__(self, obj):
|
||||
# type: (object) -> object
|
||||
from numpy import ascontiguousarray
|
||||
self.shape = obj.shape
|
||||
self.dtype = obj.dtype.descr if obj.dtype.fields else obj.dtype.str
|
||||
@@ -300,6 +306,7 @@ class CannedBytes(CannedObject):
|
||||
wrap = staticmethod(buffer_to_bytes)
|
||||
|
||||
def __init__(self, obj):
|
||||
# type: (object) -> object
|
||||
self.buffers = [obj]
|
||||
|
||||
def get_object(self, g=None):
|
||||
|
@@ -61,6 +61,7 @@ class Reference(HasTraits):
|
||||
|
||||
class Version(Unicode):
|
||||
def __init__(self, *args, **kwargs):
|
||||
# type: (object, object) -> object
|
||||
self.min = kwargs.pop('min', None)
|
||||
self.max = kwargs.pop('max', None)
|
||||
kwargs['default_value'] = self.min
|
||||
|
@@ -35,6 +35,7 @@ class YAPKernel(KernelBase):
|
||||
_sys_eval_input = Any()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# type: (object) -> object
|
||||
super(YAPKernel, self).__init__(**kwargs)
|
||||
|
||||
# Initialize the InteractiveShell subclass
|
||||
@@ -376,6 +377,7 @@ class YAPKernel(KernelBase):
|
||||
|
||||
class Kernel(YAPKernel):
|
||||
def __init__(self, *args, **kwargs):
|
||||
# type: (object, object) -> object
|
||||
import warnings
|
||||
warnings.warn('Kernel is a deprecated alias of yap_kernel.yapkernel.YAPKernel',
|
||||
DeprecationWarning)
|
||||
|
Reference in New Issue
Block a user