fix swi call leak
improve yapi reformat
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user