From 4a7a5b771585218513d4903720c413ea5e1cc697 Mon Sep 17 00:00:00 2001 From: kaalam Date: Thu, 14 Mar 2024 13:03:26 +0100 Subject: [PATCH 1/4] [REFACTOR] Renames to exp_decay The argument was given two names "exp_decay" and "exponential_decay" which generated doxy inconsitency. --- .../reels_event_optimization_colab.ipynb | 2 +- src/reels/__init__.py | 4 +- src/reels/py_reels.i | 4 +- src/reels/py_reels_wrap.cpp | 506 +++++++++--------- src/reels/reels.cpp | 12 +- src/reels/reels.h | 8 +- 6 files changed, 268 insertions(+), 268 deletions(-) diff --git a/notebooks/reels_event_optimization_colab.ipynb b/notebooks/reels_event_optimization_colab.ipynb index b27b28b..3486172 100644 --- a/notebooks/reels_event_optimization_colab.ipynb +++ b/notebooks/reels_event_optimization_colab.ipynb @@ -1714,7 +1714,7 @@ "\n", "The next two, `sum_dep` and `n_dep` provide an idea of how deep the code is found on average (== sum_dep/n_dep) in the sequence and can be used in the score when exponential decay is not zero.\n", "\n", - "The next is `edf` (exponential decay factor) and multiplies the final score. E.g. If we set `exponential_decay` to 0.00693 it decays to approx 0.5 in 100 steps because (1- 0.00693)^100 is 0.4988.\n", + "The next is `edf` (exponential decay factor) and multiplies the final score. E.g. If we set `exp_decay` to 0.00693 it decays to approx 0.5 in 100 steps because (1- 0.00693)^100 is 0.4988.\n", "\n", "The next two are the proportion (or lower bound for the confidence interval) of target/seen for both \"incl\" and \"succ\" as explained above.\n", "\n", diff --git a/src/reels/__init__.py b/src/reels/__init__.py index b0253e6..0803d3f 100644 --- a/src/reels/__init__.py +++ b/src/reels/__init__.py @@ -74,8 +74,8 @@ def events_insert_row(id, p_e, p_d, w): def events_define_event(id, p_e, p_d, w, code): return _py_reels.events_define_event(id, p_e, p_d, w, code) -def events_optimize_events(id, id_clips, id_targets, num_steps, codes_per_step, threshold, force_include, force_exclude, x_form, agg, p, depth, as_states, exponential_decay, lower_bound_p, log_lift): - return _py_reels.events_optimize_events(id, id_clips, id_targets, num_steps, codes_per_step, threshold, force_include, force_exclude, x_form, agg, p, depth, as_states, exponential_decay, lower_bound_p, log_lift) +def events_optimize_events(id, id_clips, id_targets, num_steps, codes_per_step, threshold, force_include, force_exclude, x_form, agg, p, depth, as_states, exp_decay, lower_bound_p, log_lift): + return _py_reels.events_optimize_events(id, id_clips, id_targets, num_steps, codes_per_step, threshold, force_include, force_exclude, x_form, agg, p, depth, as_states, exp_decay, lower_bound_p, log_lift) def events_load_block(id, p_block): return _py_reels.events_load_block(id, p_block) diff --git a/src/reels/py_reels.i b/src/reels/py_reels.i index 96e118e..485e403 100644 --- a/src/reels/py_reels.i +++ b/src/reels/py_reels.i @@ -7,7 +7,7 @@ extern bool events_define_event(int id, char *p_e, char *p_d, double w, int code); extern char *events_optimize_events(int id, int id_clips, int id_targets, int num_steps, int codes_per_step, double threshold, char *force_include, char *force_exclude, char *x_form, char *agg, double p, int depth, - int as_states, double exponential_decay, double lower_bound_p, bool log_lift); + int as_states, double exp_decay, double lower_bound_p, bool log_lift); extern bool events_load_block(int id, char *p_block); extern int events_save(int id); extern char *events_describe_next_event(int id, char *prev_event); @@ -66,7 +66,7 @@ extern bool events_insert_row(int id, char *p_e, char *p_d, double w); extern bool events_define_event(int id, char *p_e, char *p_d, double w, int code); extern char *events_optimize_events(int id, int id_clips, int id_targets, int num_steps, int codes_per_step, double threshold, char *force_include, char *force_exclude, char *x_form, char *agg, double p, int depth, - int as_states, double exponential_decay, double lower_bound_p, bool log_lift); + int as_states, double exp_decay, double lower_bound_p, bool log_lift); extern bool events_load_block(int id, char *p_block); extern int events_save(int id); extern char *events_describe_next_event(int id, char *prev_event); diff --git a/src/reels/py_reels_wrap.cpp b/src/reels/py_reels_wrap.cpp index 56c0268..509c59f 100644 --- a/src/reels/py_reels_wrap.cpp +++ b/src/reels/py_reels_wrap.cpp @@ -757,7 +757,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define PyString_FromString(x) PyUnicode_FromString(x) #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) #define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) +#define PyString_Size(str) PyBytes_Size(str) #define PyString_InternFromString(key) PyUnicode_InternFromString(key) #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) @@ -816,7 +816,7 @@ SWIGINTERN PyObject* SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); + return PyUnicode_FromString(c); #else return PyString_FromString(c); #endif @@ -953,7 +953,7 @@ SWIG_Python_RaiseOrModifyTypeError(const char *message) # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ # ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { @@ -1070,7 +1070,7 @@ typedef struct swig_const_info { #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define swig_owntype int @@ -1097,26 +1097,26 @@ typedef struct swig_const_info { #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj) -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail /* Runtime API implementation */ /* Error manipulation */ -SWIGINTERN void +SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetObject(errtype, obj); Py_DECREF(obj); SWIG_PYTHON_THREAD_END_BLOCK; } -SWIGINTERN void +SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; PyErr_SetString(errtype, msg); @@ -1137,7 +1137,7 @@ SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { } SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { PyDict_SetItemString(d, name, obj); Py_DECREF(obj); if (public_interface) @@ -1147,9 +1147,9 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam #else SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); + Py_DECREF(obj); } #endif @@ -1184,11 +1184,11 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi if (!min && !max) { return 1; } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int)min); return 0; } - } + } if (!PyTuple_Check(args)) { if (min <= 1 && max >= 1) { Py_ssize_t i; @@ -1203,11 +1203,11 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi } else { Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); return 0; } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { @@ -1219,7 +1219,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi objs[l] = 0; } return i + 1; - } + } } } @@ -1268,7 +1268,7 @@ extern "C" { /* The python void return value */ -SWIGRUNTIMEINLINE PyObject * +SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void) { PyObject *none = Py_None; @@ -1288,7 +1288,7 @@ typedef struct { PyTypeObject *pytype; } SwigPyClientData; -SWIGRUNTIMEINLINE int +SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty) { SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; @@ -1306,7 +1306,7 @@ SWIG_Python_ExceptionType(swig_type_info *desc) { } -SWIGRUNTIME SwigPyClientData * +SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject* obj) { if (!obj) { @@ -1352,7 +1352,7 @@ SwigPyClientData_New(PyObject* obj) } } -SWIGRUNTIME void +SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData *data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); @@ -1445,7 +1445,7 @@ SwigPyObject_repr(SwigPyObject *v) PyString_ConcatAndDel(&repr,nrep); # endif } - return repr; + return repr; } /* We need a version taking two PyObject* parameters so it's a valid @@ -1474,7 +1474,7 @@ SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; + return res; } @@ -1534,7 +1534,7 @@ SwigPyObject_dealloc(PyObject *v) StopIteration will be active right now, and this needs to remain true upon return from SwigPyObject_dealloc. So save and restore. */ - + PyObject *type = NULL, *value = NULL, *traceback = NULL; PyErr_Fetch(&type, &value, &traceback); @@ -1554,19 +1554,19 @@ SwigPyObject_dealloc(PyObject *v) PyErr_Restore(type, value, traceback); Py_XDECREF(res); - } + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) else { const char *name = SWIG_TypePrettyName(ty); printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } #endif - } + } Py_XDECREF(next); PyObject_DEL(v); } -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* SwigPyObject_append(PyObject* v, PyObject* next) { SwigPyObject *sobj = (SwigPyObject *) v; @@ -1579,11 +1579,11 @@ SwigPyObject_append(PyObject* v, PyObject* next) return SWIG_Py_Void(); } -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { + if (sobj->next) { Py_INCREF(sobj->next); return sobj->next; } else { @@ -1622,7 +1622,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } else { SwigPyObject_disown(v,args); } - } + } return obj; } } @@ -1635,7 +1635,7 @@ swigobject_methods[] = { {"append", SwigPyObject_append, METH_O, "appends another 'this' object"}, {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"}, {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"}, - {0, 0, 0, 0} + {0, 0, 0, 0} }; SWIGRUNTIME PyTypeObject* @@ -1803,7 +1803,7 @@ SwigPyPacked_repr(SwigPyPacked *v) return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { return SWIG_Python_str_FromFormat("", v->ty->name); - } + } } SWIGRUNTIME PyObject * @@ -1814,7 +1814,7 @@ SwigPyPacked_str(SwigPyPacked *v) return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { return SWIG_Python_str_FromChar(v->ty->name); - } + } } SWIGRUNTIME int @@ -1836,7 +1836,7 @@ SwigPyPacked_type(void) { SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) + return ((op)->ob_type == SwigPyPacked_TypeOnce()) || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); } @@ -1988,11 +1988,11 @@ SWIG_This(void) /* TODO: I don't know how to implement the fast getset in Python 3 right now */ #if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS +#define SWIG_PYTHON_SLOW_GETSET_THIS #endif SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) +SWIG_Python_GetSwigThis(PyObject *pyobj) { PyObject *obj; @@ -2015,7 +2015,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); + obj = _PyInstance_Lookup(pyobj, SWIG_This()); } else { PyObject **dictptr = _PyObject_GetDictPtr(pyobj); if (dictptr != NULL) { @@ -2048,7 +2048,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #endif if (obj && !SwigPyObject_Check(obj)) { /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ + SwigPyObject from it */ return SWIG_Python_GetSwigThis(obj); } return (SwigPyObject *)obj; @@ -2155,7 +2155,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int res = SWIG_AddCast(res); res = SWIG_AddNewMask(res); } else { - res = SWIG_AddCast(res); + res = SWIG_AddCast(res); } } } @@ -2218,7 +2218,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t } } return SWIG_OK; -} +} /* ----------------------------------------------------------------------------- * Create a new pointer object @@ -2229,7 +2229,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t 'this' attribute. */ -SWIGRUNTIME PyObject* +SWIGRUNTIME PyObject* SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) { PyObject *inst = 0; @@ -2300,7 +2300,7 @@ SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) } #endif return PyObject_SetAttr(inst, SWIG_This(), swig_this); -} +} SWIGINTERN PyObject * @@ -2382,7 +2382,7 @@ SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { } /* -----------------------------------------------------------------------------* - * Get type list + * Get type list * -----------------------------------------------------------------------------*/ #ifdef SWIG_LINK_RUNTIME @@ -2452,7 +2452,7 @@ SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { @@ -2470,7 +2470,7 @@ SWIG_Python_TypeQuery(const char *type) return descriptor; } -/* +/* For backward compatibility only */ #define SWIG_POINTER_EXCEPTION 0 @@ -2479,7 +2479,7 @@ SWIG_Python_TypeQuery(const char *type) SWIGRUNTIME int SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ +{ if (PyErr_Occurred()) { PyObject *type = 0; PyObject *value = 0; @@ -2504,7 +2504,7 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) return 0; } } - + SWIGRUNTIME int SWIG_Python_ArgFail(int argnum) { @@ -2538,10 +2538,10 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) type, otype); return; } - } else -#endif + } else +#endif { - const char *otype = (obj ? obj->ob_type->tp_name : 0); + const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; @@ -2556,7 +2556,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) Py_XDECREF(str); return; } - } + } PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); } else { PyErr_Format(PyExc_TypeError, "unexpected type is received"); @@ -2628,7 +2628,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { } else { res = f(descr, obj, value); } - + done: Py_DECREF(name); return res; @@ -2642,9 +2642,9 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else @@ -2690,12 +2690,12 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; #endif #define SWIG_name "_py_reels" -#define SWIGVERSION 0x040002 +#define SWIGVERSION 0x040002 #define SWIG_VERSION SWIGVERSION -#define SWIG_as_voidptr(a) (void *)((const void *)(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) +#define SWIG_as_voidptr(a) (void *)((const void *)(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) extern int new_events(); @@ -2704,7 +2704,7 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0}; extern bool events_define_event(int id, char *p_e, char *p_d, double w, int code); extern char *events_optimize_events(int id, int id_clips, int id_targets, int num_steps, int codes_per_step, double threshold, char *force_include, char *force_exclude, char *x_form, char *agg, double p, int depth, - int as_states, double exponential_decay, double lower_bound_p, bool log_lift); + int as_states, double exp_decay, double lower_bound_p, bool log_lift); extern bool events_load_block(int id, char *p_block); extern int events_save(int id); extern char *events_describe_next_event(int id, char *prev_event); @@ -2910,7 +2910,7 @@ SWIG_AsVal_int (PyObject * obj, int *val) } else { if (val) *val = (int)(v); } - } + } return res; } @@ -2944,7 +2944,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) #else if (PyUnicode_Check(obj)) #endif -#else +#else if (PyString_Check(obj)) #endif { @@ -3067,7 +3067,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) if (carray) { if (size > INT_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? + return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); } else { #if PY_VERSION_HEX >= 0x03000000 @@ -3086,14 +3086,14 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) } -SWIGINTERNINLINE PyObject * +SWIGINTERNINLINE PyObject * SWIG_FromCharPtr(const char *cptr) -{ +{ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); } - #define SWIG_From_double PyFloat_FromDouble + #define SWIG_From_double PyFloat_FromDouble #ifdef __cplusplus extern "C" { @@ -3101,7 +3101,7 @@ extern "C" { SWIGINTERN PyObject *_wrap_new_events(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int result; - + if (!SWIG_Python_UnpackTuple(args, "new_events", 0, 0, 0)) SWIG_fail; result = (int)new_events(); resultobj = SWIG_From_int((int)(result)); @@ -3118,13 +3118,13 @@ SWIGINTERN PyObject *_wrap_destroy_events(PyObject *SWIGUNUSEDPARM(self), PyObje int ecode1 = 0 ; PyObject *swig_obj[1] ; bool result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_events" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (bool)destroy_events(arg1); resultobj = SWIG_From_bool((bool)(result)); @@ -3152,12 +3152,12 @@ SWIGINTERN PyObject *_wrap_events_insert_row(PyObject *SWIGUNUSEDPARM(self), PyO int ecode4 = 0 ; PyObject *swig_obj[4] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "events_insert_row", 4, 4, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_insert_row" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3172,7 +3172,7 @@ SWIGINTERN PyObject *_wrap_events_insert_row(PyObject *SWIGUNUSEDPARM(self), PyO ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "events_insert_row" "', argument " "4"" of type '" "double""'"); - } + } arg4 = (double)(val4); result = (bool)events_insert_row(arg1,arg2,arg3,arg4); resultobj = SWIG_From_bool((bool)(result)); @@ -3207,12 +3207,12 @@ SWIGINTERN PyObject *_wrap_events_define_event(PyObject *SWIGUNUSEDPARM(self), P int ecode5 = 0 ; PyObject *swig_obj[5] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "events_define_event", 5, 5, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_define_event" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3227,12 +3227,12 @@ SWIGINTERN PyObject *_wrap_events_define_event(PyObject *SWIGUNUSEDPARM(self), P ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "events_define_event" "', argument " "4"" of type '" "double""'"); - } + } arg4 = (double)(val4); ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "events_define_event" "', argument " "5"" of type '" "int""'"); - } + } arg5 = (int)(val5); result = (bool)events_define_event(arg1,arg2,arg3,arg4,arg5); resultobj = SWIG_From_bool((bool)(result)); @@ -3302,37 +3302,37 @@ SWIGINTERN PyObject *_wrap_events_optimize_events(PyObject *SWIGUNUSEDPARM(self) int ecode16 = 0 ; PyObject *swig_obj[16] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "events_optimize_events", 16, 16, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_optimize_events" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "events_optimize_events" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "events_optimize_events" "', argument " "3"" of type '" "int""'"); - } + } arg3 = (int)(val3); ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "events_optimize_events" "', argument " "4"" of type '" "int""'"); - } + } arg4 = (int)(val4); ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "events_optimize_events" "', argument " "5"" of type '" "int""'"); - } + } arg5 = (int)(val5); ecode6 = SWIG_AsVal_double(swig_obj[5], &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "events_optimize_events" "', argument " "6"" of type '" "double""'"); - } + } arg6 = (double)(val6); res7 = SWIG_AsCharPtrAndSize(swig_obj[6], &buf7, NULL, &alloc7); if (!SWIG_IsOK(res7)) { @@ -3357,32 +3357,32 @@ SWIGINTERN PyObject *_wrap_events_optimize_events(PyObject *SWIGUNUSEDPARM(self) ecode11 = SWIG_AsVal_double(swig_obj[10], &val11); if (!SWIG_IsOK(ecode11)) { SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "events_optimize_events" "', argument " "11"" of type '" "double""'"); - } + } arg11 = (double)(val11); ecode12 = SWIG_AsVal_int(swig_obj[11], &val12); if (!SWIG_IsOK(ecode12)) { SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "events_optimize_events" "', argument " "12"" of type '" "int""'"); - } + } arg12 = (int)(val12); ecode13 = SWIG_AsVal_int(swig_obj[12], &val13); if (!SWIG_IsOK(ecode13)) { SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "events_optimize_events" "', argument " "13"" of type '" "int""'"); - } + } arg13 = (int)(val13); ecode14 = SWIG_AsVal_double(swig_obj[13], &val14); if (!SWIG_IsOK(ecode14)) { SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "events_optimize_events" "', argument " "14"" of type '" "double""'"); - } + } arg14 = (double)(val14); ecode15 = SWIG_AsVal_double(swig_obj[14], &val15); if (!SWIG_IsOK(ecode15)) { SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "events_optimize_events" "', argument " "15"" of type '" "double""'"); - } + } arg15 = (double)(val15); ecode16 = SWIG_AsVal_bool(swig_obj[15], &val16); if (!SWIG_IsOK(ecode16)) { SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "events_optimize_events" "', argument " "16"" of type '" "bool""'"); - } + } arg16 = (bool)(val16); result = (char *)events_optimize_events(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16); resultobj = SWIG_FromCharPtr((const char *)result); @@ -3411,12 +3411,12 @@ SWIGINTERN PyObject *_wrap_events_load_block(PyObject *SWIGUNUSEDPARM(self), PyO int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "events_load_block", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_load_block" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3440,13 +3440,13 @@ SWIGINTERN PyObject *_wrap_events_save(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_save" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)events_save(arg1); resultobj = SWIG_From_int((int)(result)); @@ -3467,12 +3467,12 @@ SWIGINTERN PyObject *_wrap_events_describe_next_event(PyObject *SWIGUNUSEDPARM(s int alloc2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "events_describe_next_event", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_describe_next_event" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3499,17 +3499,17 @@ SWIGINTERN PyObject *_wrap_events_set_max_num_events(PyObject *SWIGUNUSEDPARM(se int ecode2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "events_set_max_num_events", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_set_max_num_events" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "events_set_max_num_events" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (bool)events_set_max_num_events(arg1,arg2); resultobj = SWIG_From_bool((bool)(result)); @@ -3529,17 +3529,17 @@ SWIGINTERN PyObject *_wrap_events_set_store_strings(PyObject *SWIGUNUSEDPARM(sel int ecode2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "events_set_store_strings", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_set_store_strings" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "events_set_store_strings" "', argument " "2"" of type '" "bool""'"); - } + } arg2 = (bool)(val2); result = (bool)events_set_store_strings(arg1,arg2); resultobj = SWIG_From_bool((bool)(result)); @@ -3556,13 +3556,13 @@ SWIGINTERN PyObject *_wrap_events_num_events(PyObject *SWIGUNUSEDPARM(self), PyO int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "events_num_events" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)events_num_events(arg1); resultobj = SWIG_From_int((int)(result)); @@ -3575,7 +3575,7 @@ SWIGINTERN PyObject *_wrap_events_num_events(PyObject *SWIGUNUSEDPARM(self), PyO SWIGINTERN PyObject *_wrap_new_clients(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int result; - + if (!SWIG_Python_UnpackTuple(args, "new_clients", 0, 0, 0)) SWIG_fail; result = (int)new_clients(); resultobj = SWIG_From_int((int)(result)); @@ -3592,13 +3592,13 @@ SWIGINTERN PyObject *_wrap_destroy_clients(PyObject *SWIGUNUSEDPARM(self), PyObj int ecode1 = 0 ; PyObject *swig_obj[1] ; bool result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_clients" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (bool)destroy_clients(arg1); resultobj = SWIG_From_bool((bool)(result)); @@ -3619,12 +3619,12 @@ SWIGINTERN PyObject *_wrap_clients_hash_client_id(PyObject *SWIGUNUSEDPARM(self) int alloc2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "clients_hash_client_id", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_hash_client_id" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3652,12 +3652,12 @@ SWIGINTERN PyObject *_wrap_clients_add_client_id(PyObject *SWIGUNUSEDPARM(self), int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "clients_add_client_id", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_add_client_id" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3684,17 +3684,17 @@ SWIGINTERN PyObject *_wrap_clients_hash_by_index(PyObject *SWIGUNUSEDPARM(self), int ecode2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "clients_hash_by_index", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_hash_by_index" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "clients_hash_by_index" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (char *)clients_hash_by_index(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); @@ -3711,13 +3711,13 @@ SWIGINTERN PyObject *_wrap_clients_num_clients(PyObject *SWIGUNUSEDPARM(self), P int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_num_clients" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)clients_num_clients(arg1); resultobj = SWIG_From_int((int)(result)); @@ -3738,12 +3738,12 @@ SWIGINTERN PyObject *_wrap_clients_load_block(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "clients_load_block", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_load_block" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3767,13 +3767,13 @@ SWIGINTERN PyObject *_wrap_clients_save(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clients_save" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)clients_save(arg1); resultobj = SWIG_From_int((int)(result)); @@ -3793,17 +3793,17 @@ SWIGINTERN PyObject *_wrap_new_clips(PyObject *SWIGUNUSEDPARM(self), PyObject *a int ecode2 = 0 ; PyObject *swig_obj[2] ; int result; - + if (!SWIG_Python_UnpackTuple(args, "new_clips", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_clips" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_clips" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (int)new_clips(arg1,arg2); resultobj = SWIG_From_int((int)(result)); @@ -3820,13 +3820,13 @@ SWIGINTERN PyObject *_wrap_destroy_clips(PyObject *SWIGUNUSEDPARM(self), PyObjec int ecode1 = 0 ; PyObject *swig_obj[1] ; bool result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_clips" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (bool)destroy_clips(arg1); resultobj = SWIG_From_bool((bool)(result)); @@ -3847,12 +3847,12 @@ SWIGINTERN PyObject *_wrap_clips_set_time_format(PyObject *SWIGUNUSEDPARM(self), int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "clips_set_time_format", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_set_time_format" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3895,12 +3895,12 @@ SWIGINTERN PyObject *_wrap_clips_scan_event(PyObject *SWIGUNUSEDPARM(self), PyOb int alloc6 = 0 ; PyObject *swig_obj[6] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "clips_scan_event", 6, 6, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_scan_event" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3915,7 +3915,7 @@ SWIGINTERN PyObject *_wrap_clips_scan_event(PyObject *SWIGUNUSEDPARM(self), PyOb ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "clips_scan_event" "', argument " "4"" of type '" "double""'"); - } + } arg4 = (double)(val4); res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5); if (!SWIG_IsOK(res5)) { @@ -3954,12 +3954,12 @@ SWIGINTERN PyObject *_wrap_clips_hash_by_previous(PyObject *SWIGUNUSEDPARM(self) int alloc2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "clips_hash_by_previous", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_hash_by_previous" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -3987,12 +3987,12 @@ SWIGINTERN PyObject *_wrap_clips_load_block(PyObject *SWIGUNUSEDPARM(self), PyOb int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "clips_load_block", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_load_block" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4016,13 +4016,13 @@ SWIGINTERN PyObject *_wrap_clips_save(PyObject *SWIGUNUSEDPARM(self), PyObject * int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_save" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)clips_save(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4043,12 +4043,12 @@ SWIGINTERN PyObject *_wrap_clips_describe_clip(PyObject *SWIGUNUSEDPARM(self), P int alloc2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "clips_describe_clip", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_describe_clip" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4072,13 +4072,13 @@ SWIGINTERN PyObject *_wrap_clips_num_clips(PyObject *SWIGUNUSEDPARM(self), PyObj int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_num_clips" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)clips_num_clips(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4095,13 +4095,13 @@ SWIGINTERN PyObject *_wrap_clips_num_events(PyObject *SWIGUNUSEDPARM(self), PyOb int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_num_events" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)clips_num_events(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4121,17 +4121,17 @@ SWIGINTERN PyObject *_wrap_clips_test_sequence(PyObject *SWIGUNUSEDPARM(self), P int ecode2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "clips_test_sequence", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clips_test_sequence" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "clips_test_sequence" "', argument " "2"" of type '" "bool""'"); - } + } arg2 = (bool)(val2); result = (char *)clips_test_sequence(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); @@ -4148,13 +4148,13 @@ SWIGINTERN PyObject *_wrap_new_targets(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_targets" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)new_targets(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4171,13 +4171,13 @@ SWIGINTERN PyObject *_wrap_destroy_targets(PyObject *SWIGUNUSEDPARM(self), PyObj int ecode1 = 0 ; PyObject *swig_obj[1] ; bool result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_targets" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (bool)destroy_targets(arg1); resultobj = SWIG_From_bool((bool)(result)); @@ -4198,12 +4198,12 @@ SWIGINTERN PyObject *_wrap_targets_set_time_format(PyObject *SWIGUNUSEDPARM(self int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "targets_set_time_format", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_set_time_format" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4235,12 +4235,12 @@ SWIGINTERN PyObject *_wrap_targets_insert_target(PyObject *SWIGUNUSEDPARM(self), int alloc3 = 0 ; PyObject *swig_obj[3] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "targets_insert_target", 3, 3, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_insert_target" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4288,12 +4288,12 @@ SWIGINTERN PyObject *_wrap_targets_fit(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode6 = 0 ; PyObject *swig_obj[6] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "targets_fit", 6, 6, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_fit" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4308,17 +4308,17 @@ SWIGINTERN PyObject *_wrap_targets_fit(PyObject *SWIGUNUSEDPARM(self), PyObject ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); if (!SWIG_IsOK(ecode4)) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "targets_fit" "', argument " "4"" of type '" "double""'"); - } + } arg4 = (double)(val4); ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); if (!SWIG_IsOK(ecode5)) { SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "targets_fit" "', argument " "5"" of type '" "int""'"); - } + } arg5 = (int)(val5); ecode6 = SWIG_AsVal_int(swig_obj[5], &val6); if (!SWIG_IsOK(ecode6)) { SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "targets_fit" "', argument " "6"" of type '" "int""'"); - } + } arg6 = (int)(val6); result = (bool)targets_fit(arg1,arg2,arg3,arg4,arg5,arg6); resultobj = SWIG_From_bool((bool)(result)); @@ -4342,17 +4342,17 @@ SWIGINTERN PyObject *_wrap_targets_predict_clients(PyObject *SWIGUNUSEDPARM(self int ecode2 = 0 ; PyObject *swig_obj[2] ; int result; - + if (!SWIG_Python_UnpackTuple(args, "targets_predict_clients", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_predict_clients" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "targets_predict_clients" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (int)targets_predict_clients(arg1,arg2); resultobj = SWIG_From_int((int)(result)); @@ -4372,17 +4372,17 @@ SWIGINTERN PyObject *_wrap_targets_predict_clips(PyObject *SWIGUNUSEDPARM(self), int ecode2 = 0 ; PyObject *swig_obj[2] ; int result; - + if (!SWIG_Python_UnpackTuple(args, "targets_predict_clips", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_predict_clips" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "targets_predict_clips" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (int)targets_predict_clips(arg1,arg2); resultobj = SWIG_From_int((int)(result)); @@ -4403,12 +4403,12 @@ SWIGINTERN PyObject *_wrap_targets_load_block(PyObject *SWIGUNUSEDPARM(self), Py int alloc2 = 0 ; PyObject *swig_obj[2] ; bool result; - + if (!SWIG_Python_UnpackTuple(args, "targets_load_block", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_load_block" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { @@ -4432,13 +4432,13 @@ SWIGINTERN PyObject *_wrap_targets_save(PyObject *SWIGUNUSEDPARM(self), PyObject int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_save" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)targets_save(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4455,13 +4455,13 @@ SWIGINTERN PyObject *_wrap_targets_num_targets(PyObject *SWIGUNUSEDPARM(self), P int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_num_targets" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)targets_num_targets(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4484,22 +4484,22 @@ SWIGINTERN PyObject *_wrap_targets_tree_node_idx(PyObject *SWIGUNUSEDPARM(self), int ecode3 = 0 ; PyObject *swig_obj[3] ; int result; - + if (!SWIG_Python_UnpackTuple(args, "targets_tree_node_idx", 3, 3, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_tree_node_idx" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "targets_tree_node_idx" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); if (!SWIG_IsOK(ecode3)) { SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "targets_tree_node_idx" "', argument " "3"" of type '" "int""'"); - } + } arg3 = (int)(val3); result = (int)targets_tree_node_idx(arg1,arg2,arg3); resultobj = SWIG_From_int((int)(result)); @@ -4519,17 +4519,17 @@ SWIGINTERN PyObject *_wrap_targets_tree_node_children(PyObject *SWIGUNUSEDPARM(s int ecode2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "targets_tree_node_children", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_tree_node_children" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "targets_tree_node_children" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (char *)targets_tree_node_children(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); @@ -4549,17 +4549,17 @@ SWIGINTERN PyObject *_wrap_targets_describe_tree_node(PyObject *SWIGUNUSEDPARM(s int ecode2 = 0 ; PyObject *swig_obj[2] ; char *result = 0 ; - + if (!SWIG_Python_UnpackTuple(args, "targets_describe_tree_node", 2, 2, swig_obj)) SWIG_fail; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_describe_tree_node" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "targets_describe_tree_node" "', argument " "2"" of type '" "int""'"); - } + } arg2 = (int)(val2); result = (char *)targets_describe_tree_node(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); @@ -4576,13 +4576,13 @@ SWIGINTERN PyObject *_wrap_targets_describe_tree(PyObject *SWIGUNUSEDPARM(self), int ecode1 = 0 ; PyObject *swig_obj[1] ; char *result = 0 ; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "targets_describe_tree" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (char *)targets_describe_tree(arg1); resultobj = SWIG_FromCharPtr((const char *)result); @@ -4599,13 +4599,13 @@ SWIGINTERN PyObject *_wrap_size_result_iterator(PyObject *SWIGUNUSEDPARM(self), int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "size_result_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)size_result_iterator(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4622,13 +4622,13 @@ SWIGINTERN PyObject *_wrap_next_result_iterator(PyObject *SWIGUNUSEDPARM(self), int ecode1 = 0 ; PyObject *swig_obj[1] ; double result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "next_result_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (double)next_result_iterator(arg1); resultobj = SWIG_From_double((double)(result)); @@ -4644,13 +4644,13 @@ SWIGINTERN PyObject *_wrap_destroy_result_iterator(PyObject *SWIGUNUSEDPARM(self int val1 ; int ecode1 = 0 ; PyObject *swig_obj[1] ; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_result_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); destroy_result_iterator(arg1); resultobj = SWIG_Py_Void(); @@ -4667,13 +4667,13 @@ SWIGINTERN PyObject *_wrap_size_binary_image_iterator(PyObject *SWIGUNUSEDPARM(s int ecode1 = 0 ; PyObject *swig_obj[1] ; int result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "size_binary_image_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (int)size_binary_image_iterator(arg1); resultobj = SWIG_From_int((int)(result)); @@ -4690,13 +4690,13 @@ SWIGINTERN PyObject *_wrap_next_binary_image_iterator(PyObject *SWIGUNUSEDPARM(s int ecode1 = 0 ; PyObject *swig_obj[1] ; char *result = 0 ; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "next_binary_image_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (char *)next_binary_image_iterator(arg1); resultobj = SWIG_FromCharPtr((const char *)result); @@ -4713,13 +4713,13 @@ SWIGINTERN PyObject *_wrap_destroy_binary_image_iterator(PyObject *SWIGUNUSEDPAR int ecode1 = 0 ; PyObject *swig_obj[1] ; bool result; - + if (!args) SWIG_fail; swig_obj[0] = args; ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); if (!SWIG_IsOK(ecode1)) { SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "destroy_binary_image_iterator" "', argument " "1"" of type '" "int""'"); - } + } arg1 = (int)(val1); result = (bool)destroy_binary_image_iterator(arg1); resultobj = SWIG_From_bool((bool)(result)); @@ -4870,7 +4870,7 @@ SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int init; - + /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ @@ -4881,7 +4881,7 @@ SWIG_InitializeModule(void *clientdata) { } else { init = 0; } - + /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { @@ -4898,18 +4898,18 @@ SWIG_InitializeModule(void *clientdata) { } iter=iter->next; } while (iter!= module_head); - + /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } - + /* When multiple interpreters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ if (init == 0) return; - + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); @@ -4918,11 +4918,11 @@ SWIG_InitializeModule(void *clientdata) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; - + #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); #endif - + /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); @@ -4941,7 +4941,7 @@ SWIG_InitializeModule(void *clientdata) { } else { type = swig_module.type_initial[i]; } - + /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { @@ -4972,7 +4972,7 @@ SWIG_InitializeModule(void *clientdata) { if (!ocast) ret = 0; } } - + if (!ret) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); @@ -4989,7 +4989,7 @@ SWIG_InitializeModule(void *clientdata) { swig_module.types[i] = type; } swig_module.types[i] = 0; - + #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { @@ -5017,10 +5017,10 @@ SWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; - + if (init_run) return; init_run = 1; - + for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; @@ -5048,28 +5048,28 @@ SWIG_PropagateClientData(void) { #ifdef __cplusplus extern "C" { #endif - + /* Python-specific SWIG API */ #define SWIG_newvarlink() SWIG_Python_newvarlink() #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - + /* ----------------------------------------------------------------------------- * global variable support code. * ----------------------------------------------------------------------------- */ - + typedef struct swig_globalvar { char *name; /* Name of global variable */ PyObject *(*get_attr)(void); /* Return the current value */ int (*set_attr)(PyObject *); /* Set the value */ struct swig_globalvar *next; } swig_globalvar; - + typedef struct swig_varlinkobject { PyObject_HEAD swig_globalvar *vars; } swig_varlinkobject; - + SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 @@ -5078,7 +5078,7 @@ extern "C" { return PyString_FromString(""); #endif } - + SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { #if PY_VERSION_HEX >= 0x03000000 @@ -5116,7 +5116,7 @@ extern "C" { #endif return str; } - + SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v) { swig_globalvar *var = v->vars; @@ -5127,7 +5127,7 @@ extern "C" { var = n; } } - + SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n) { PyObject *res = NULL; @@ -5144,7 +5144,7 @@ extern "C" { } return res; } - + SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { int res = 1; @@ -5161,7 +5161,7 @@ extern "C" { } return res; } - + SWIGINTERN PyTypeObject* swig_varlink_type(void) { static char varlink__doc__[] = "Swig var link object"; @@ -5226,7 +5226,7 @@ extern "C" { } return &varlink_type; } - + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { @@ -5236,8 +5236,8 @@ extern "C" { } return ((PyObject*) result); } - - SWIGINTERN void + + SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { swig_varlinkobject *v = (swig_varlinkobject *) p; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); @@ -5253,7 +5253,7 @@ extern "C" { } v->vars = gv; } - + SWIGINTERN PyObject * SWIG_globals(void) { static PyObject *globals = 0; @@ -5262,11 +5262,11 @@ extern "C" { } return globals; } - + /* ----------------------------------------------------------------------------- * constants/methods manipulation * ----------------------------------------------------------------------------- */ - + /* Install Constants */ SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { @@ -5290,11 +5290,11 @@ extern "C" { } } } - + /* -----------------------------------------------------------------------------*/ /* Fix SwigMethods to carry the callback ptrs when needed */ /* -----------------------------------------------------------------------------*/ - + SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, @@ -5310,7 +5310,7 @@ extern "C" { swig_const_info *ci = 0; const char *name = c + 10; for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, + if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) { ci = &(const_table[j]); break; @@ -5337,17 +5337,17 @@ extern "C" { } } } - } - + } + /* ----------------------------------------------------------------------------- * Method creation and docstring support functions * ----------------------------------------------------------------------------- */ - + /* ----------------------------------------------------------------------------- * Function to find the method definition with the correct docstring for the * proxy module as opposed to the low-level API * ----------------------------------------------------------------------------- */ - + SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) { /* Find the function in the modified method table */ size_t offset = 0; @@ -5362,12 +5362,12 @@ extern "C" { /* Use the copy with the modified docstring if available */ return found ? &SwigMethods_proxydocs[offset] : NULL; } - + /* ----------------------------------------------------------------------------- * Wrapper of PyInstanceMethod_New() used in Python 3 * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ - + SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { if (PyCFunction_Check(func)) { PyCFunctionObject *funcobj = (PyCFunctionObject *)func; @@ -5381,12 +5381,12 @@ extern "C" { return PyMethod_New(func, NULL, NULL); #endif } - + /* ----------------------------------------------------------------------------- * Wrapper of PyStaticMethod_New() * It is exported to the generated module, used for -fastproxy * ----------------------------------------------------------------------------- */ - + SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { if (PyCFunction_Check(func)) { PyCFunctionObject *funcobj = (PyCFunctionObject *)func; @@ -5396,7 +5396,7 @@ extern "C" { } return PyStaticMethod_New(func); } - + #ifdef __cplusplus } #endif @@ -5409,7 +5409,7 @@ extern "C" { extern "C" #endif -SWIGEXPORT +SWIGEXPORT #if PY_VERSION_HEX >= 0x03000000 PyObject* #else @@ -5417,7 +5417,7 @@ void #endif SWIG_init(void) { PyObject *m, *d, *md, *globals; - + #if PY_VERSION_HEX >= 0x03000000 static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, @@ -5431,7 +5431,7 @@ SWIG_init(void) { NULL }; #endif - + #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { 0, 0, 0, 0, 0, 0, 0 @@ -5459,21 +5459,21 @@ SWIG_init(void) { PyObject *thisown_descr; PyObject *self = 0; int i; - + (void)builtin_pytype; (void)builtin_base_count; (void)builtin_basetype; (void)tuple; (void)static_getset; (void)self; - + /* Metaclass is used to implement static member variables */ metatype = SwigPyObjectType(); assert(metatype); #endif - + (void)globals; - + /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ SWIG_This(); SWIG_Python_TypeCache(); @@ -5481,24 +5481,24 @@ SWIG_init(void) { #ifndef SWIGPYTHON_BUILTIN SwigPyObject_type(); #endif - + /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - + #if PY_VERSION_HEX >= 0x03000000 m = PyModule_Create(&SWIG_module); #else m = Py_InitModule(SWIG_name, SwigMethods); #endif - + md = d = PyModule_GetDict(m); (void)md; - + SWIG_InitializeModule(0); - + #ifdef SWIGPYTHON_BUILTIN swigpyobject = SwigPyObject_TypeOnce(); - + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -5513,19 +5513,19 @@ SWIG_init(void) { return; # endif } - + /* All objects have a 'this' attribute */ this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); (void)this_descr; - + /* All objects have a 'thisown' attribute */ thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); (void)thisown_descr; - + public_interface = PyList_New(0); public_symbol = 0; (void)public_symbol; - + PyDict_SetItemString(md, "__all__", public_interface); Py_DECREF(public_interface); for (i = 0; SwigMethods[i].ml_name != NULL; ++i) @@ -5533,9 +5533,9 @@ SWIG_init(void) { for (i = 0; swig_const_table[i].name != 0; ++i) SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); #endif - + SWIG_InstallConstants(d,swig_const_table); - + #if PY_VERSION_HEX >= 0x03000000 return m; #else diff --git a/src/reels/reels.cpp b/src/reels/reels.cpp index a507f1f..c11f739 100644 --- a/src/reels/reels.cpp +++ b/src/reels/reels.cpp @@ -274,7 +274,7 @@ bool Events::define_event(pChar p_e, pChar p_d, double w, uint64_t code) { String Events::optimize_events (Clips &clips, TargetMap &targets, int num_steps, int codes_per_step, double threshold, pCodeSet p_force_include, pCodeSet p_force_exclude, Transform x_form, Aggregate agg, double p, - int depth, bool as_states, double exponential_decay, double lower_bound_p, bool log_lift) { + int depth, bool as_states, double exp_decay, double lower_bound_p, bool log_lift) { // Use a logger as a debug tool and to return errors. @@ -347,7 +347,7 @@ String Events::optimize_events (Clips &clips, TargetMap &targets, int num_steps, log.log_printf(" Current score = %.6f\n", large_score); - CodeScores top_code = get_top_codes(codes_stat, targ_prop, exponential_decay, lower_bound_p, log_lift); + CodeScores top_code = get_top_codes(codes_stat, targ_prop, exp_decay, lower_bound_p, log_lift); // Main (over num_steps) loop @@ -532,7 +532,7 @@ bool compare_score_item(const CodeScoreItem a, const CodeScoreItem b) { } -CodeScores Events::get_top_codes(CodeInTreeStatMap &codes_stat, double targ_prop, double exponential_decay, double lower_bound_p, bool log_lift) { +CodeScores Events::get_top_codes(CodeInTreeStatMap &codes_stat, double targ_prop, double exp_decay, double lower_bound_p, bool log_lift) { CodeScores ev = {}; ClipMap clm = {}; @@ -555,7 +555,7 @@ CodeScores Events::get_top_codes(CodeInTreeStatMap &codes_stat, double targ_prop REELS_logger.log_printf("n_succ_seen\tn_succ_target\tn_incl_seen\tn_incl_target\tsum_dep\tn_dep\tedf\tprop_succ\tprop_incl\tlift\tscore\tcode\n"); for (CodeInTreeStatMap::iterator it = codes_stat.begin(); it != codes_stat.end(); ++it) { - double edf = it->second.n_dep > 0 ? exp(-exponential_decay*it->second.sum_dep/it->second.n_dep) : 0; + double edf = it->second.n_dep > 0 ? exp(-exp_decay*it->second.sum_dep/it->second.n_dep) : 0; double succ = std::max((double) 0.0, tar.agresti_coull_lower_bound(it->second.n_succ_target, it->second.n_succ_seen)); double incl = std::max((double) 0.0, tar.agresti_coull_lower_bound(it->second.n_incl_target, it->second.n_incl_seen)); double lift = succ > 0.001 ? incl/succ : 0; @@ -1802,7 +1802,7 @@ bool events_define_event(int id, char *p_e, char *p_d, double w, int code) { */ char *events_optimize_events(int id, int id_clips, int id_targets, int num_steps, int codes_per_step, double threshold, char *force_include, char *force_exclude, char *x_form, char *agg, double p, int depth, int as_states, - double exponential_decay, double lower_bound_p, bool log_lift) { + double exp_decay, double lower_bound_p, bool log_lift) { answer_buffer[0] = 0; EventsServer::iterator it = events.find(id); @@ -1859,7 +1859,7 @@ char *events_optimize_events(int id, int id_clips, int id_targets, int num_steps Aggregate ag = strcmp("mean", agg) == 0 ? ag_mean : strcmp("longest", agg) == 0 ? ag_longest : ag_minimax; String ret = it->second->optimize_events(*it_clip->second, *it_targ->second->p_target(), num_steps, codes_per_step, threshold, - p_force_include, p_force_exclude, xfm, ag, p, depth, as_states, exponential_decay, + p_force_include, p_force_exclude, xfm, ag, p, depth, as_states, exp_decay, lower_bound_p, log_lift); REELS_logger.log = ret + "\ncode_performance\n" + REELS_logger.log; diff --git a/src/reels/reels.h b/src/reels/reels.h index e115b10..a3a615c 100644 --- a/src/reels/reels.h +++ b/src/reels/reels.h @@ -432,7 +432,7 @@ class Events { \param p The p argument to fit the internal Targets object prediction model. \param depth The depth argument to fit the internal Targets object prediction model. \param as_states The as_states argument to fit the internal Targets object prediction model. - \param exponential_decay Exponential Decay Factor applied to the internal score in terms of depth. That score selects what + \param exp_decay Exponential Decay Factor applied to the internal score in terms of depth. That score selects what codes enter the model. The decay is applied to the average tree depth. 0 is no decay, default value = 0.00693 decays to 0.5 in 100 steps. \param lower_bound_p Another p for lower bound, but applied to the scoring process rather than the model. @@ -443,7 +443,7 @@ class Events { String optimize_events (Clips &clips, TargetMap &targets, int num_steps = 10, int codes_per_step = 5, double threshold = 0.0001, pCodeSet p_force_include = nullptr, pCodeSet p_force_exclude = nullptr, Transform x_form = tr_linear, Aggregate agg = ag_longest, double p = 0.5, int depth = 1000, bool as_states = true, - double exponential_decay = 0.00693, double lower_bound_p = 0.95, bool log_lift = true); + double exp_decay = 0.00693, double lower_bound_p = 0.95, bool log_lift = true); /** \brief Internal: Do one step of the optimize_events() method. @@ -472,7 +472,7 @@ class Events { \param codes_stat A complete CodeInTreeStatMap computed by score_model(). \param targ_prop The targets/seen proportion at the tree root. - \param exponential_decay Exponential Decay Factor applied to the internal score in terms of depth. That score selects what + \param exp_decay Exponential Decay Factor applied to the internal score in terms of depth. That score selects what codes enter the model. The decay is applied to the average tree depth. 0 is no decay, default value = 0.00693 decays to 0.5 in 100 steps. \param lower_bound_p Another p for lower bound, but applied to the scoring process rather than the model. @@ -480,7 +480,7 @@ class Events { \return A sorted (by lift) vector of codes top first. */ - CodeScores get_top_codes(CodeInTreeStatMap &codes_stat, double targ_prop, double exponential_decay, double lower_bound_p, + CodeScores get_top_codes(CodeInTreeStatMap &codes_stat, double targ_prop, double exp_decay, double lower_bound_p, bool log_lift); From 169843c3d7488bbf26930f62287a27c2e048630b Mon Sep 17 00:00:00 2001 From: kaalam Date: Thu, 14 Mar 2024 13:03:59 +0100 Subject: [PATCH 2/4] Extracts standalone methods too --- src/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Doxyfile b/src/Doxyfile index 5fcb239..e4555ce 100644 --- a/src/Doxyfile +++ b/src/Doxyfile @@ -499,7 +499,7 @@ NUM_PROC_THREADS = 1 # normally produced when WARNINGS is set to YES. # The default value is: NO. -EXTRACT_ALL = NO +EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. From e7d22bd0f34174c13909e00ee35e5fef889ab85d Mon Sep 17 00:00:00 2001 From: kaalam Date: Thu, 14 Mar 2024 13:07:06 +0100 Subject: [PATCH 3/4] [FIX] Fixes doxy issues --- src/reels/reels.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reels/reels.cpp b/src/reels/reels.cpp index c11f739..2908d9f 100644 --- a/src/reels/reels.cpp +++ b/src/reels/reels.cpp @@ -1785,8 +1785,8 @@ bool events_define_event(int id, char *p_e, char *p_d, double w, int code) { \param num_steps The number of steps to iterate. The method will stop early if no codes are found at a step. \param codes_per_step The number of codes to be tried from the top of the priority list at each step. \param threshold A minimum threshold, below which a score change is not considered improvement. - \param p_force_include An optional pointer to a set of codes that must be included before starting. - \param p_force_exclude An optional pointer to a set of codes that will excluded and set to the base code. + \param force_include An optional pointer to a set of codes that must be included before starting. + \param force_exclude An optional pointer to a set of codes that will excluded and set to the base code. \param x_form The x_form argument to fit the internal Targets object prediction model. \param agg The agg argument to fit the internal Targets object prediction model. \param p The p argument to fit the internal Targets object prediction model. @@ -2362,6 +2362,7 @@ bool destroy_clips(int id) { /** \brief Sets the public property time_format to simplify the python interface in a Clips object stored by the ClipsServer. + \param id The id returned by a previous new_clips() call. \param fmt The time format in standard calendar time format http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html @@ -2699,6 +2700,7 @@ bool destroy_targets(int id) { /** \brief Sets the public property time_format to simplify the python interface in a Targets object stored by the TargetsServer. + \param id The id returned by a previous new_targets() call. \param fmt The time format in standard calendar time format http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html @@ -2742,6 +2744,7 @@ bool targets_insert_target(int id, char *p_c, char *p_t) { /** \brief Fit the prediction model in a Targets object stored by the TargetsServer. + \param id The id returned by a previous new_targets() call. \param x_form A possible transformation of the times. (Currently "log" or "linear".) \param agg The mechanism used for the aggregation. (Currently "minimax", "mean" or "longest".) \param p The width of the confidence interval for the binomial proportion used to calculate the lower bound. From 0e7f6668c3d21d2720542287318617a54017cced Mon Sep 17 00:00:00 2001 From: kaalam Date: Thu, 14 Mar 2024 14:52:20 +0100 Subject: [PATCH 4/4] Fixes mkdoc warnings --- src/reels/Clients.py | 33 ++++++++++++------------ src/reels/Clips.py | 38 +++++++++++++-------------- src/reels/Events.py | 61 ++++++++++++++++++++++---------------------- src/reels/Intake.py | 13 ++++------ src/reels/Targets.py | 45 ++++++++++++++++---------------- 5 files changed, 91 insertions(+), 99 deletions(-) diff --git a/src/reels/Clients.py b/src/reels/Clients.py index 5dbb807..5fe1df7 100644 --- a/src/reels/Clients.py +++ b/src/reels/Clients.py @@ -53,7 +53,6 @@ def __next__(self): class Clients: - """Interface to the c++ container object to hold clients. The purpose of this object is to be filled (via successive add_client_id() @@ -62,9 +61,8 @@ class Clients: for size and iterated by calling client_hashes(). Args: - binary_image: An optional binary image (returned by save_as_binary_image()) - to initialize the object with data copied from another Clients - object. + binary_image (list): An optional binary image (returned by save_as_binary_image()) + to initialize the object with data copied from another Clients object. """ def __init__(self, binary_image=None): @@ -98,10 +96,10 @@ def hash_client_id(self, client): """Convert a client id into a hash (as stored buy the internal C** Clients object). Args: - client: The "client". A string representing "the actor". + client (str): The "client". A string representing "the actor". Returns: - The hash as a decimal python string starting with 'h' to prevent numeric conversion. + (str): The hash as a decimal python string starting with 'h' to prevent numeric conversion. """ return clients_hash_client_id(self.cl_id, client) @@ -109,10 +107,10 @@ def add_client_id(self, client): """Define clients explicitly. Args: - client: The "client". A string representing "the actor". + client (str): The "client". A string representing "the actor". Returns: - True on success. + (bool): True on success. """ return clients_add_client_id(self.cl_id, client) @@ -120,16 +118,17 @@ def client_hashes(self): """Return an iterator to iterate over all the hashed client ids. Returns: - An iterator (a ClientsHashes object) + (ClientsHashes): An iterator (a ClientsHashes object) """ return ClientsHashes(self.cl_id, self.num_clients()) def num_clients(self): """Return the number of clients in the object. + The container will add one client per add_client_id() call and keep the order. + Returns: - The number of clients stored in the object which may include repeated ids. - The container will add one client per add_client_id() call and keep the order. + (int): The number of clients stored in the object which may include repeated ids. """ return clients_num_clients(self.cl_id) @@ -138,10 +137,10 @@ def save_as_binary_image(self): list of strings referred to a binary_image. Returns: - The binary_image containing the state of the Clients. There is - not much you can do with it except serializing it as a Python - (e.g., pickle) object and loading it into another Clients object. - Pass it to the constructor to create an initialized object, + (list): The binary_image containing the state of the Clients. There is + not much you can do with it except serializing it as a Python + (e.g., pickle) object and loading it into another Clients object. + Pass it to the constructor to create an initialized object, """ bi_idx = clients_save(self.cl_id) if bi_idx == 0: @@ -161,10 +160,10 @@ def load_from_binary_image(self, binary_image): returned by a previous save_as_binary_image() call. Args: - binary_image: A list of strings returned by save_as_binary_image() + binary_image (list): A list of strings returned by save_as_binary_image() Returns: - True on success, destroys, initializes and returns false on failure. + (bool): True on success, destroys, initializes and returns false on failure. """ failed = False diff --git a/src/reels/Clips.py b/src/reels/Clips.py index 6cf1453..108bb8b 100644 --- a/src/reels/Clips.py +++ b/src/reels/Clips.py @@ -58,7 +58,6 @@ def __next__(self): class Clips: - """Interface to the c++ container object to hold clips. The purpose of this object is to be filled (via successive scan_event() @@ -81,7 +80,7 @@ class Clips: """ def __init__( - self, clients: Clients, events: Events, time_format=None, binary_image=None + self, clients: Clients, events: Events, time_format: str=None, binary_image: list=None ): self.cp_id = new_clips(clients.cl_id, events.ev_id) @@ -109,7 +108,7 @@ def __setstate__(self, state): self.cp_id = new_clips(new_clients(), new_events()) self.load_from_binary_image(state) - def scan_event(self, emitter, description, weight, client, time): + def scan_event(self, emitter: str, description: str, weight: float, client: str, time: str): """Process a row from a transaction file, to add the event to the client's timeline in a Clips object. Args: @@ -121,8 +120,8 @@ def scan_event(self, emitter, description, weight, client, time): is given via the time_format argument to the constructor.) Returns: - True on insertion. False usually just means, the event is not in events - or the client is not in clients. It may be a time parsing error too. + (bool): True on insertion. False usually just means, the event is not in events + or the client is not in clients. It may be a time parsing error too. """ return clips_scan_event(self.cp_id, emitter, description, weight, client, time) @@ -130,7 +129,7 @@ def clips_client_hashes(self): """Return an iterator to iterate over all the hashed client ids. Returns: - An iterator (a ClipsHashes object) + (ClipsHashes): An iterator (a ClipsHashes object) """ return ClipsHashes(self.cp_id) @@ -138,8 +137,7 @@ def num_clips(self): """Return the number of clips in the object. Returns: - The number of clips stored in the object. Clips are indexed by unique - client hash. + (int): The number of clips stored in the object. Clips are indexed by unique client hash. """ return clips_num_clips(self.cp_id) @@ -147,7 +145,7 @@ def num_events(self): """Return the number of events counting all the clips stored by the object. Returns: - The number of events stored in the object. + (int): The number of events stored in the object. """ return clips_num_events(self.cp_id) @@ -155,10 +153,10 @@ def describe_clip(self, client): """Return a list ot the codes in chronological order for a given client. Args: - client: Either a client identifier or the hash of a client identifier returned by Clients.hash_client_id(). + client (str): Either a client identifier or the hash of a client identifier returned by Clients.hash_client_id(). Returns: - A list of integer codes on success or None on failure. + (list): A list of integer codes on success or None on failure. """ s = clips_describe_clip(self.cp_id, client) @@ -170,10 +168,10 @@ def save_as_binary_image(self): list of strings referred to a binary_image. Returns: - The binary_image containing the state of the Clips. There is - not much you can do with it except serializing it as a Python - (e.g., pickle) object and loading it into another Clips object. - Pass it to the constructor to create an initialized object, + (list): The binary_image containing the state of the Clips. There is + not much you can do with it except serializing it as a Python + (e.g., pickle) object and loading it into another Clips object. + Pass it to the constructor to create an initialized object, """ bi_idx = clips_save(self.cp_id) if bi_idx == 0: @@ -193,10 +191,10 @@ def load_from_binary_image(self, binary_image): returned by a previous save_as_binary_image() call. Args: - binary_image: A list of strings returned by save_as_binary_image() + binary_image (list): A list of strings returned by save_as_binary_image() Returns: - True on success, destroys, initializes and returns false on failure. + (bool): True on success, destroys, initializes and returns false on failure. """ failed = False @@ -220,11 +218,11 @@ def test_sequence(self, seq_num, target): This returns one of the 500 non target sequences or one of the 500 target sequences. Args: - seq_num: The sequence id (in range 0.499). - target: True for one of the target sequences, false for non target. + seq_num (int): The sequence id (in range 0.499). + target (bool): True for one of the target sequences, false for non target. Returns: - A sequence of integer codes list or None if seq_num is out of range. + (list): A sequence of integer codes list or None if seq_num is out of range. """ s = clips_test_sequence(seq_num, target) diff --git a/src/reels/Events.py b/src/reels/Events.py index 4d985c6..6050a43 100644 --- a/src/reels/Events.py +++ b/src/reels/Events.py @@ -57,7 +57,6 @@ def __next__(self): class Events: - """Interface to the c++ container object to hold events. The purpose of this object is to be filled (either via successive @@ -67,11 +66,11 @@ class Events: methods exist. Args: - max_num_events: The maximum number of events to limit the discovery via - insert_row() to the max_num_events more frequent/recent. - binary_image: An optional binary image (returned by save_as_binary_image()) - to initialize the object with data copied from another Events - object. + max_num_events (int): The maximum number of events to limit the discovery via + insert_row() to the max_num_events more frequent/recent. + binary_image (bool): An optional binary image (returned by save_as_binary_image()) + to initialize the object with data copied from another Events + object. """ def __init__(self, max_num_events=1000, binary_image=None): @@ -111,12 +110,12 @@ def insert_row(self, emitter, description, weight): either one way or the other. Args: - emitter: The "emitter". A C/Python string representing "owner of event". - description: The "description". A C/Python string representing "the event". - weight: The "weight". A double representing a weight of the event. + emitter (str): The "emitter". A C/Python string representing "owner of event". + description (str): The "description". A C/Python string representing "the event". + weight (float): The "weight". A double representing a weight of the event. Returns: - True on success. + (bool): True on success. """ return events_insert_row(self.ev_id, emitter, description, weight) @@ -128,13 +127,13 @@ def define_event(self, emitter, description, weight, code): either one way or the other. Args: - emitter: The "emitter". A C/Python string representing "owner of event". - description: The "description". A C/Python string representing "the event". - weight: The "weight". A double representing a weight of the event. - code: A unique code number identifying the event. + emitter (str): The "emitter". A C/Python string representing "owner of event". + description (str): The "description". A C/Python string representing "the event". + weight (float): The "weight". A double representing a weight of the event. + code (int): A unique code number identifying the event. Returns: - True on success. + (bool): True on success. """ return events_define_event(self.ev_id, emitter, description, weight, code) @@ -142,7 +141,7 @@ def num_events(self): """Return the number of events in the object. Returns: - The number of events stored in the object. + (int): The number of events stored in the object. """ return events_num_events(self.ev_id) @@ -150,7 +149,7 @@ def describe_events(self): """Return an iterator of (emitter, description, weight, code) tuples describing all events. Returns: - An iterator of (emitter, description, weight, code) tuple on success or None on failure. + (EventTuples): An iterator of (emitter, description, weight, code) tuple on success or None on failure. """ return EventTuples(self.ev_id) @@ -159,10 +158,10 @@ def save_as_binary_image(self): list of strings referred to a binary_image. Returns: - The binary_image containing the state of the Events. There is - not much you can do with it except serializing it as a Python - (e.g., pickle) object and loading it into another Events object. - Pass it to the constructor to create an initialized object, + (list): The binary_image containing the state of the Events. There is + not much you can do with it except serializing it as a Python + (e.g., pickle) object and loading it into another Events object. + Pass it to the constructor to create an initialized object, """ bi_idx = events_save(self.ev_id) if bi_idx == 0: @@ -182,10 +181,10 @@ def load_from_binary_image(self, binary_image): returned by a previous save_as_binary_image() call. Args: - binary_image: A list of strings returned by save_as_binary_image() + binary_image (list): A list of strings returned by save_as_binary_image() Returns: - True on success, destroys, initializes and returns false on failure. + (bool): True on success, destroys, initializes and returns false on failure. """ failed = False @@ -204,9 +203,9 @@ def load_from_binary_image(self, binary_image): return True - def optimize_events(self, clips, targets, num_steps=10, codes_per_step=5, threshold=0.0001, force_include='', - force_exclude='', x_form='linear', agg='longest', p=0.5, depth=1000, as_states=True, - exp_decay=0.00693, lower_bound_p=0.95, log_lift=True): + def optimize_events(self, clips: int, targets: int, num_steps: int=10, codes_per_step: int=5, threshold: float=0.0001, + force_include: str='', force_exclude: str='', x_form: str='linear', agg: str='longest', p: float=0.5, + depth: int=1000, as_states: bool=True, exp_decay: float=0.00693, lower_bound_p: float=0.95, log_lift: bool=True): """Events optimizer. Optimizes the events to maximize prediction signal. (F1 score over same number of positives.) @@ -245,7 +244,7 @@ def optimize_events(self, clips, targets, num_steps=10, codes_per_step=5, thresh log_lift: A boolean to set if lift (= LB(included)/LB(after inclusion)) is log() transformed or not. Returns: - A tuple (success, dictionary, top_codes, log) + (tuple): A tuple (success, dictionary, top_codes, log) """ ret = events_optimize_events(self.ev_id, clips.cp_id, targets.tr_id, num_steps, codes_per_step, threshold, force_include, @@ -281,12 +280,12 @@ def copy(self, dictionary = None): with either optimize_events() or a Targets object, not to continue populating it with events via insert_row(). Args: - dictionary: A dictionary to be applied during the copy. The dictionary must be returned by a previous optimize_events() - of an identical object in order to have the same codes defined. Otherwise, the codes not present in the dictionary - will not be translated into events. + dictionary (dict): A dictionary to be applied during the copy. The dictionary must be returned by a previous optimize_events() + of an identical object in order to have the same codes defined. Otherwise, the codes not present in the dictionary + will not be translated into events. Returns: - A new Events object + (Events): A new Events object """ ret = Events(max_num_events = self.max_num_events) diff --git a/src/reels/Intake.py b/src/reels/Intake.py index 1fdd60e..e61fd1f 100644 --- a/src/reels/Intake.py +++ b/src/reels/Intake.py @@ -47,7 +47,6 @@ def __init__(self): class SparkEventsAcc(AccumulatorParam): - """ This is an internal AccumulatorParam descendant to propagate the tuples created by a user defined function (inside the Intake) applied via .foreach() in the workers. It is a reducer in a map/reduce paradigm generating a complete reduced result in the driver. @@ -86,7 +85,6 @@ def addInPlace(self, acc, aux): class SparkClipsAcc(AccumulatorParam): - """ This is an internal AccumulatorParam descendant to propagate the tuples created by a user defined function (inside the Intake) applied via .foreach() in the workers. It is a reducer in a map/reduce paradigm generating a complete reduced result in the driver. @@ -125,7 +123,6 @@ def addInPlace(self, acc, aux): class Intake: - """Utility class to efficiently populate any reels object with data either from pandas or pyspark dataframes. This object implements data populating methods (in plural) that call the equivalent methods (in singular) over a complete dataframe. @@ -143,7 +140,7 @@ class Intake: you can try the more efficient but also more experimental 'accumulator' value. """ - def __init__(self, dataframe, spark_method='local_iterator'): + def __init__(self, dataframe: pd.DataFrame, spark_method: str='local_iterator'): self.pd_data = None self.sp_data = None @@ -177,7 +174,7 @@ def __str__(self): def __repr__(self): return self.__str__() - def insert_rows(self, events, columns=None): + def insert_rows(self, events: object, columns: list=None): """Populate an Events object calling events.insert_row() over the entire dataframe. Args: @@ -217,7 +214,7 @@ def f(row): for row in self.sp_data.rdd.toLocalIterator(): lambda_f(row) - def define_events(self, events, columns=None): + def define_events(self, events: object, columns: str=None): """Populate an Events object calling events.define_event() over the entire dataframe. Args: @@ -242,7 +239,7 @@ def define_events(self, events, columns=None): for row in self.sp_data.rdd.toLocalIterator(): lambda_f(row) - def scan_events(self, clips, columns=None): + def scan_events(self, clips: object, columns: str=None): """Populate a Clips object calling clips.scan_event() over the entire dataframe. Args: @@ -288,7 +285,7 @@ def f(row): for row in self.sp_data.rdd.toLocalIterator(): lambda_f(row) - def insert_targets(self, targets, columns=None): + def insert_targets(self, targets: object, columns: list=None): """Populate a Targets object calling targets.insert_target() over the entire dataframe. Args: diff --git a/src/reels/Targets.py b/src/reels/Targets.py index 490f68a..b4c6dd1 100644 --- a/src/reels/Targets.py +++ b/src/reels/Targets.py @@ -68,7 +68,6 @@ def __next__(self): class Targets: - """Interface to the c++ container object to hold clips. This object fits the model for a set of targets defined via insert_target(). @@ -84,7 +83,7 @@ class Targets: object. You have to pass empty clips to use this. """ - def __init__(self, clips: Clips, time_format=None, binary_image=None): + def __init__(self, clips: Clips, time_format: str=None, binary_image: list=None): self.tr_id = new_targets(clips.cp_id) self.cp_id = clips.cp_id @@ -119,7 +118,7 @@ def __setstate__(self, state): self.tr_id = new_targets(new_clips(new_clients(), new_events())) self.load_from_binary_image(state) - def insert_target(self, client, time): + def insert_target(self, client: str, time: str): """Define the targets before calling fit() by calling this method once for each client. Args: @@ -128,12 +127,12 @@ def insert_target(self, client, time): is given via the time_format argument to the constructor.) Returns: - True on new clients. False if the client is already in the object or the time - is in the wrong format. + (bool): True on new clients. False if the client is already in the object or the time + is in the wrong format. """ return targets_insert_target(self.tr_id, client, time) - def fit(self, x_form="log", agg="minimax", p=0.5, depth=8, as_states=False): + def fit(self, x_form: str='log', agg: str='minimax', p: float=0.5, depth: int=8, as_states: bool=False): """Fit the prediction model in the object stored after calling insert_target() multiple times. Fit can only be called once in the life of a Targets object and predict_*() cannot be called before fit(). @@ -148,7 +147,7 @@ def fit(self, x_form="log", agg="minimax", p=0.5, depth=8, as_states=False): When used, the ClipMap passed to the constructor by reference will be converted to states as a side effect. Returns: - True on success. Error if already fitted, wrong arguments or the id is not found. + (bool): True on success. Error if already fitted, wrong arguments or the id is not found. """ return targets_fit(self.tr_id, x_form, agg, p, depth, as_states) @@ -164,7 +163,7 @@ def predict_clients(self, clients: Clients): clients: The Clients object containing the ids of the clients you want to predict or a list of client ids. Returns: - An iterator object containing the results. (Empty on error.) + (bool): An iterator object containing the results. (Empty on error.) """ if type(clients) == list: cli = Clients() @@ -183,7 +182,7 @@ def predict_clips(self, clips: Clips): clips: The clips you want to predict. Returns: - An iterator object containing the results. (Empty on error.) + (Result): An iterator object containing the results. (Empty on error.) """ return Result(targets_predict_clips(self.tr_id, clips.cp_id)) @@ -193,11 +192,11 @@ def num_targets(self): This mostly for debugging, verifying that the number of successful insert_target() is as expected. Returns: - The number of target points stored in the internal target object. + (int): The number of target points stored in the internal target object. """ return targets_num_targets(self.tr_id) - def tree_node_idx(self, parent_idx, code): + def tree_node_idx(self, parent_idx: int, code: int): """Returns the index of a tree node by parent node and code. Args: @@ -205,32 +204,32 @@ def tree_node_idx(self, parent_idx, code): code: The code that leads in the tree from the parent node to the child node. Returns: - On success, i.e, if both the parent index exists and contains the code, it will return the index of the child (-1 otherwise). + (int): On success, i.e, if both the parent index exists and contains the code, it will return the index of the child (-1 otherwise). """ return targets_tree_node_idx(self.tr_id, parent_idx, code) - def tree_node_children(self, idx): + def tree_node_children(self, idx: int): """Return a list ot the codes of the children of a node in the tree by index. Args: idx: The zero-based index identifying the node (0 for root or a value returned by tree_node_idx()). Returns: - A list of integer codes on success or None on failure. + (list): A list of integer codes on success or None on failure. """ s = targets_tree_node_children(self.tr_id, idx) if len(s) != 0: return [int(i) for i in s.split('\t')] - def describe_tree_node(self, idx): + def describe_tree_node(self, idx: int): """Return a tuple (n_seen, n_target, sum_time_d, num_codes) describing a node in the tree by index. Args: idx: The zero-based index identifying the node (0 for root or a value returned by tree_node_idx()). Returns: - A tuple (n_seen, n_target, sum_time_d, num_codes) on success or None on failure. + (tuple): A tuple (n_seen, n_target, sum_time_d, num_codes) on success or None on failure. """ s = targets_describe_tree_node(self.tr_id, idx) @@ -242,7 +241,7 @@ def describe_tree(self): """Describes some statistics of a fitted tree inside a Targets object. Returns: - On success, it will return a descriptive text with node count numbers for different node content. + (str): On success, it will return a descriptive text with node count numbers for different node content. """ return targets_describe_tree(self.tr_id) @@ -252,10 +251,10 @@ def save_as_binary_image(self): list of strings referred to a binary_image. Returns: - The binary_image containing the state of the Targets. There is - not much you can do with it except serializing it as a Python - (e.g., pickle) object and loading it into another Targets object. - Pass it to the constructor to create an initialized object, + (list): The binary_image containing the state of the Targets. There is + not much you can do with it except serializing it as a Python + (e.g., pickle) object and loading it into another Targets object. + Pass it to the constructor to create an initialized object, """ bi_idx = targets_save(self.tr_id) if bi_idx == 0: @@ -275,10 +274,10 @@ def load_from_binary_image(self, binary_image): returned by a previous save_as_binary_image() call. Args: - binary_image: A list of strings returned by save_as_binary_image() + binary_image (list): A list of strings returned by save_as_binary_image() Returns: - True on success, destroys, initializes and returns false on failure. + (bool): True on success, destroys, initializes and returns false on failure. """ failed = False