<commit_before>#include <Python.h>
#include <ueye.h>

static PyObject *ids_numcams(PyObject *self, PyObject *args);

static PyMethodDef  idsMethods[] = {
    {"numcams", ids_numcams, METH_VARARGS, "Return the number of cameras connected."},
    {NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC initids(void) {
    (void) Py_InitModule("ids", idsMethods);
}

int main(int argc, char *argv[]) {
    /* Pass argv[0] to the Python interpreter */
    Py_SetProgramName(argv[0]);

    /* Initialize the Python interpreter.  Required. */
    Py_Initialize();

    /* Add a static module */
    initids();

    return 0;
}

static PyObject *ids_numcams(PyObject *self, PyObject *args) {
    UEYE_CAMERA_LIST    cameras;

    is_GetNumberOfCameras((int*) &cameras.dwCount);

    return Py_BuildValue("i", cameras.dwCount);
}<commit_msg>Add Camera class<commit_after>#include <Python.h>
#include <ueye.h>

static PyObject *ids_numcams(PyObject *self, PyObject *args);

typedef struct {
    PyObject_HEAD;
    /* Type fields here */
} ids_CameraObject;

static PyTypeObject ids_CameraType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    "ids.Camera",              /* tp_name */
    sizeof(ids_CameraObject),  /* tp_basicsize */
    0,                         /* tp_itemsize */
    0,                         /* tp_dealloc */
    0,                         /* tp_print */
    0,                         /* tp_getattr */
    0,                         /* tp_setattr */
    0,                         /* tp_reserved */
    0,                         /* tp_repr */
    0,                         /* tp_as_number */
    0,                         /* tp_as_sequence */
    0,                         /* tp_as_mapping */
    0,                         /* tp_hash  */
    0,                         /* tp_call */
    0,                         /* tp_str */
    0,                         /* tp_getattro */
    0,                         /* tp_setattro */
    0,                         /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,        /* tp_flags */
    "IDS Camera Object",       /* tp_doc */
};

static PyMethodDef  idsMethods[] = {
    {"number_cameras", ids_number_cameras, METH_VARARGS, "Return the number of cameras connected."},
    {NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC initids(void) {
    PyObject* m;

    ids_CameraType.tp_new = PyType_GenericNew;
    if (PyType_Ready(&ids_CameraType) < 0) {
        return;
    }

    m = Py_InitModule("ids", idsMethods);

    Py_INCREF(&ids_CameraType);
    PyModule_AddObject(m, "Camera", (PyObject *) &ids_CameraType);
}

int main(int argc, char *argv[]) {
    /* Pass argv[0] to the Python interpreter */
    Py_SetProgramName(argv[0]);

    /* Initialize the Python interpreter.  Required. */
    Py_Initialize();

    /* Add a static module */
    initids();

    return 0;
}

static PyObject *ids_number_cameras(PyObject *self, PyObject *args) {
    UEYE_CAMERA_LIST    cameras;

    is_GetNumberOfCameras((int*) &cameras.dwCount);

    return Py_BuildValue("i", cameras.dwCount);
}

//static PyObject *ids_camera_list(PyObject *self, PyObject *args) {
//    UEYE_CAMERA_LIST    cameras;
//
//    is_GetCameraList(&cameras);
//}
{'fraction_non_alphanumeric': 0.1258719086873811, 'fraction_numerical': 0.008243500317057704, 'mean_word_length': 1.9541198501872659, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1800297', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1012, 'n_words': 216}