fix swi call leak
improve yapi reformat
This commit is contained in:
parent
6b545c8f71
commit
d7e21c80df
4474
C/c_interface.c
4474
C/c_interface.c
File diff suppressed because it is too large
Load Diff
@ -283,7 +283,7 @@ static inline bool Yap_RecoverHandles__(int n, yhandle_t topHandle USES_REGS) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
LOCAL_CurHandle -= n;
|
||||
LOCAL_CurHandle = topHandle;
|
||||
// fprintf(stderr,"RS %ld %s:%d\n", LOCAL_CurHandle, __FILE__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
46
gtags.conf
46
gtags.conf
@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2010, 2011, 2013,
|
||||
# 2015, 2016
|
||||
# Tama Communications Corporation
|
||||
#
|
||||
# This file is part of GNU GLOBAL.
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# *
|
||||
# Configuration file for GNU GLOBAL source code tag system.
|
||||
#
|
||||
# Basically, GLOBAL doesn't need this file ('gtags.conf'), because it has
|
||||
# default values in itsself. If you have the file as '/etc/gtags.conf' or
|
||||
# "$HOME/.globalrc" in your system then GLOBAL overwrite the default values
|
||||
# with the values in the file.
|
||||
#
|
||||
# The format is similar to termcap(5). You can specify a target with
|
||||
# GTAGSLABEL environment variable. Default target is 'default'.
|
||||
#
|
||||
# If you want to have a common record for yourself, it is recommended to
|
||||
# use the following method:
|
||||
#
|
||||
|
||||
common:
|
||||
:skip=Debug/,Release/,Threads/,mxe/,xcode/,codeblocks/,Qt/,xcode/,android/,compile_commands.json,xml/,YAPDroid/app/build/,YAPDroid/lib/build/:HTML/,HTML.pub/,tags,TAGS,ID,y.tab.c,y.tab.h,gtags.files,cscope.files,cscope.out,cscope.po.out,cscope.in.out,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,autom4te.cache/,*.orig,*.rej,*.bak,*~,#*#,*.swp,*.tmp,*_flymake.*,*_flymake:
|
||||
|
||||
|
||||
#
|
||||
# A common map for both Exuberant Ctags and Universal Ctags.
|
||||
# Don't include definitions of ctagscom and ctagslib in this entry.
|
||||
#
|
||||
default:\
|
||||
yap:native:user:
|
||||
|
||||
yap:\
|
||||
:tc=common:\
|
||||
:langmap=Prolog\:.pl.yap.ypp.P.prolog:\
|
||||
:gtags_parser=Prolog\:$ctagslib:
|
||||
|
@ -801,7 +801,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
|
||||
return false;
|
||||
}
|
||||
ARG1 = Yap_GetFromHandle(s1);
|
||||
Yap_RecoverHandles(sl, tnum - targ);
|
||||
Yap_RecoverHandles(tnum - targ, sl);
|
||||
Yap_CloseSlots(sl0);
|
||||
}
|
||||
break;
|
||||
|
@ -70,6 +70,7 @@ class Type(object):
|
||||
REFERENCE = re.compile("""^(.+)&$""")
|
||||
|
||||
def __init__(self, text):
|
||||
# type: (object) -> object
|
||||
if isinstance(text, Type):
|
||||
self.clone_from(text)
|
||||
return
|
||||
@ -128,6 +129,7 @@ class Constraint(object):
|
||||
ARG = re.compile("""((?:[^,<(]|<[^>]*>|\([^)]*\))+),?""")
|
||||
|
||||
def __init__(self, line):
|
||||
# type: (object) -> object
|
||||
if isinstance(line, Constraint):
|
||||
self.clone_from(line)
|
||||
return
|
||||
@ -182,6 +184,7 @@ def load_decls(filename):
|
||||
class DeclsLoader(object):
|
||||
|
||||
def __init__(self, filename):
|
||||
# type: (object) -> object
|
||||
self.decls = load_decls(filename)
|
||||
|
||||
def print_decls(self):
|
||||
@ -201,6 +204,7 @@ class PredGenerator(DeclsLoader):
|
||||
"TieBreakVarBranch<SetVarBranch>")
|
||||
|
||||
def __init__(self, filename):
|
||||
# type: (object) -> object
|
||||
super(PredGenerator, self).__init__(filename)
|
||||
self._change_home_to_space()
|
||||
self._change_intsharedarray_to_intargs()
|
||||
@ -291,6 +295,7 @@ class PredGenerator(DeclsLoader):
|
||||
class Cluster(object):
|
||||
|
||||
def __init__(self, name, arity):
|
||||
# type: (object, object) -> object
|
||||
self.name = name
|
||||
self.arity = arity
|
||||
self.preds = []
|
||||
@ -299,6 +304,7 @@ class Cluster(object):
|
||||
class DTree(object):
|
||||
|
||||
def __init__(self, i, preds, cluster):
|
||||
# type: (object, object, object) -> object
|
||||
self.index = i
|
||||
self.cluster = cluster
|
||||
if len(preds) == 1 and len(preds[0].argtypes) == i:
|
||||
@ -354,6 +360,7 @@ class DTree(object):
|
||||
class YAPConstraintGeneratorBase(PredGenerator):
|
||||
|
||||
def __init__(self, filename):
|
||||
# type: (object) -> object
|
||||
super(YAPConstraintGeneratorBase, self).__init__(filename)
|
||||
self._classify()
|
||||
self._dtreefy()
|
||||
@ -389,6 +396,7 @@ class YAPConstraintGeneratorBase(PredGenerator):
|
||||
class YAPConstraintPrologGenerator(YAPConstraintGeneratorBase):
|
||||
|
||||
def __init__(self, filename):
|
||||
# type: (object) -> object
|
||||
super(YAPConstraintPrologGenerator, self).__init__(filename)
|
||||
|
||||
def _prolog_clauses(self):
|
||||
@ -410,6 +418,7 @@ class YAPConstraintPrologGenerator(YAPConstraintGeneratorBase):
|
||||
class YAPConstraintCCGenerator(YAPConstraintGeneratorBase):
|
||||
|
||||
def __init__(self, filename):
|
||||
# type: (object) -> object
|
||||
super(YAPConstraintCCGenerator, self).__init__(filename)
|
||||
|
||||
def _cc_descriptors(self):
|
||||
@ -434,6 +443,7 @@ import sys
|
||||
class OStream(object):
|
||||
|
||||
def __init__(self, fd=sys.stdout):
|
||||
# type: (object) -> object
|
||||
self.file = fd
|
||||
self.column = 0
|
||||
|
||||
@ -472,6 +482,7 @@ class PrologObject(object):
|
||||
class PrologClause(PrologObject):
|
||||
|
||||
def __init__(self, head, body):
|
||||
# type: (object, object) -> object
|
||||
self.head = head
|
||||
self.body = body
|
||||
|
||||
@ -486,6 +497,7 @@ class PrologClause(PrologObject):
|
||||
class PrologLiteral(PrologObject):
|
||||
|
||||
def __init__(self, lit):
|
||||
# type: (object) -> object
|
||||
self.literal = lit
|
||||
|
||||
def pp(self, out, offset):
|
||||
@ -495,6 +507,7 @@ class PrologLiteral(PrologObject):
|
||||
class PrologIF(PrologObject):
|
||||
|
||||
def __init__(self, cond, left, right):
|
||||
# type: (object, object, object) -> object
|
||||
self.cond = cond
|
||||
self.left = left
|
||||
self.right = right
|
||||
@ -609,6 +622,7 @@ class YAPEnumPrologGenerator(object):
|
||||
class CCDescriptor(object):
|
||||
|
||||
def __init__(self, name, argtypes, api):
|
||||
# type: (object, object, object) -> object
|
||||
self.name = name
|
||||
self.argtypes = argtypes
|
||||
self.api = api
|
||||
|
@ -6,6 +6,7 @@ from pyswip.easy import getList, registerForeign
|
||||
|
||||
class Notifier:
|
||||
def __init__(self, fun):
|
||||
# type: (object) -> object
|
||||
self.fun = fun
|
||||
|
||||
def notify(self, t):
|
||||
@ -15,6 +16,7 @@ class Notifier:
|
||||
|
||||
class Tower:
|
||||
def __init__(self, N=3, interactive=False):
|
||||
# type: (object, object) -> object
|
||||
"""N is the number of disks
|
||||
"""
|
||||
self.N = N
|
||||
|
@ -12,6 +12,7 @@ URL = "http://www.sudoku.org.uk/daily.asp"
|
||||
|
||||
class DailySudokuPuzzle(HTMLParser):
|
||||
def __init__(self):
|
||||
# type: () -> object
|
||||
self.puzzle = []
|
||||
self.__in_td = False
|
||||
HTMLParser.__init__(self)
|
||||
|
@ -22,6 +22,7 @@ from pyswip.core import *
|
||||
|
||||
class InvalidTypeError(TypeError):
|
||||
def __init__(self, *args):
|
||||
# type: (object) -> object
|
||||
type = args and args[0] or "Unknown"
|
||||
msg = "Term is expected to be of type: '%s'" % type
|
||||
Exception.__init__(self, msg, *args)
|
||||
@ -31,6 +32,7 @@ class Atom(object):
|
||||
__slots__ = "handle","chars"
|
||||
|
||||
def __init__(self, handleOrChars):
|
||||
# type: (object) -> object
|
||||
"""Create an atom.
|
||||
``handleOrChars``: handle or string of the atom.
|
||||
"""
|
||||
@ -71,6 +73,7 @@ class Atom(object):
|
||||
class Term(object):
|
||||
__slots__ = "handle","chars","__value","a0"
|
||||
def __init__(self, handle=None, a0=None):
|
||||
# type: (object, object) -> object
|
||||
if handle:
|
||||
#self.handle = PL_copy_term_ref(handle)
|
||||
self.handle = handle
|
||||
@ -89,6 +92,7 @@ class Variable(object):
|
||||
__slots__ = "handle","chars"
|
||||
|
||||
def __init__(self, handle=None, name=None):
|
||||
# type: (object, object) -> object
|
||||
self.chars = None
|
||||
if name:
|
||||
self.chars = name
|
||||
@ -147,6 +151,7 @@ class Functor(object):
|
||||
func = {}
|
||||
|
||||
def __init__(self, handleOrName, arity=1, args=None, a0=None):
|
||||
# type: (object, object, object, object) -> object
|
||||
"""Create a functor.
|
||||
``handleOrName``: functor handle, a string or an atom.
|
||||
"""
|
||||
@ -436,6 +441,7 @@ class Query(object):
|
||||
fid = None
|
||||
|
||||
def __init__(self, *terms, **kwargs):
|
||||
# type: (object, object) -> object
|
||||
for key in kwargs:
|
||||
if key not in ["flags", "module"]:
|
||||
raise Exception("Invalid kwarg: %s" % key, key)
|
||||
|
@ -53,6 +53,7 @@ class Prolog:
|
||||
__slots__ = "swipl_fid","swipl_qid","error"
|
||||
|
||||
def __init__(self):
|
||||
# type: () -> object
|
||||
self.error = False
|
||||
|
||||
def __call__(self, query, maxresult, catcherrors, normalize):
|
||||
|
@ -18,7 +18,6 @@ else()
|
||||
add_library (Py4YAP SHARED ${PYTHON_SOURCES} ${PYTHON_HEADERS})
|
||||
|
||||
# arithmetic hassle.
|
||||
set_property(TARGET Py4YAP PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET Py4YAP PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
target_link_libraries(Py4YAP libYap ${PYTHON_LIBRARIES})
|
||||
@ -32,7 +31,6 @@ endif()
|
||||
|
||||
|
||||
# arithmetic hassle.
|
||||
set_property(TARGET YAPPython PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET YAPPython PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
target_link_libraries(YAPPython libYap ${PYTHON_LIBRARIES})
|
||||
|
@ -1233,6 +1233,7 @@ PyObject *compound_to_pyeval(term_t t, PyObject *context) {
|
||||
Py_DECREF(o);
|
||||
DebugPrintf("CallObject %p\n", rc);
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,15 @@
|
||||
#include "py4yap.h"
|
||||
|
||||
|
||||
X_API bool init_python_dll(void);
|
||||
O_API bool init_python_dll(void);
|
||||
|
||||
|
||||
X_API bool init_python_dll(void)
|
||||
{
|
||||
O_API bool init_python_dll(void) {
|
||||
do_init_python();
|
||||
install_pypreds();
|
||||
return 1;
|
||||
install_pypreds();
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -1,11 +1,48 @@
|
||||
|
||||
import yap
|
||||
import os.path
|
||||
import sys
|
||||
# debugging support.
|
||||
# import pdb
|
||||
from collections import namedtuple
|
||||
|
||||
from yap import *
|
||||
|
||||
class Engine( YAPEngine ):
|
||||
def __init__(self, args=None):
|
||||
# type: (object) -> object
|
||||
if not args:
|
||||
args = YAPEngineArgs()
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
args.setYapShareDir(os.path.join(yap_lib_path,"prolog"))
|
||||
args.setYapLibDir(yap_lib_path)
|
||||
args.setSavedState(os.path.join(yap_lib_path,"startup.yss"))
|
||||
YAPEngine.__init__(self,args)
|
||||
self.goal( set_prolog_flag('verbose', 'silent' ) )
|
||||
self.goal( use_module(library('yapi') ) )
|
||||
|
||||
def run(self, g, m=None):
|
||||
if m:
|
||||
self.mgoal(g, m)
|
||||
else:
|
||||
self.goal(g)
|
||||
|
||||
def f(self, g):
|
||||
self.E.fun(g)
|
||||
|
||||
|
||||
class EngineArgs( YAPEngineArgs ):
|
||||
""" Interface to Engine Options class"""
|
||||
|
||||
|
||||
class Predicate( YAPPredicate ):
|
||||
""" Interface to Generic Predicate"""
|
||||
|
||||
|
||||
class PrologPredicate( YAPPrologPredicate ):
|
||||
""" Interface to Prolog Predicate"""
|
||||
|
||||
|
||||
|
||||
global engine, handler
|
||||
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
@ -19,6 +56,7 @@ jupyter_query = namedtuple( 'jupyter_query', 'vars dict')
|
||||
python_query = namedtuple( 'python_query', 'vars dict')
|
||||
yapi_query = namedtuple( 'yapi_query', 'vars dict')
|
||||
show_answer = namedtuple( 'show_answer', 'vars dict')
|
||||
set_prolog_flag = namedtuple('set_prolog_flag', 'flag new_value')
|
||||
|
||||
def v():
|
||||
return yap.YAPVarTerm()
|
||||
@ -97,16 +135,6 @@ def query_prolog(engine, s):
|
||||
q.close()
|
||||
return
|
||||
|
||||
def boot_yap(**kwargs):
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
args = yap.YAPEngineArgs()
|
||||
args.setYapShareDir(os.path.join(yap_lib_path,"prolog"))
|
||||
args.setYapLibDir(yap_lib_path)
|
||||
args.setSavedState(os.path.join(yap_lib_path,"startup.yss"))
|
||||
engine = yap.YAPEngine(args)
|
||||
engine.goal( use_module(library('yapi') ) )
|
||||
return engine
|
||||
|
||||
def live(**kwargs):
|
||||
loop = True
|
||||
while loop:
|
||||
|
@ -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)
|
||||
|
@ -950,4 +950,4 @@ prolog:message( r_root ) -->
|
||||
|
||||
:- initialization( set_prolog_flag( double_quotes, string) ).
|
||||
|
||||
@}
|
||||
%%% @}
|
||||
|
Reference in New Issue
Block a user