Merge branch 'warnings' into 'main'

fixed module related warnings

See merge request sls_detectors_software/python_cluster_reader!2
This commit is contained in:
froejdh_e 2023-05-30 11:49:25 +02:00
commit ab7082cbea

View File

@ -8,17 +8,6 @@
PyDoc_STRVAR(read_doc, "Read clusters from open file.\n\n"
"Parameters\n"
"----------\n"
"n: max number of clusters\n"
"Returns\n"
"----------\n"
"Array of clusters read\n\n");
// Create a custom numpy data type that should reflect // Create a custom numpy data type that should reflect
// our cluster data type. // our cluster data type.
// TODO! Update with the actual cluster data type // TODO! Update with the actual cluster data type
@ -59,7 +48,7 @@ typedef struct {
// raises python exception if something goes wrong // raises python exception if something goes wrong
// returned object should mean file is open and ready to read // returned object should mean file is open and ready to read
static int ClusterFileReader_init(ClusterFileReader *self, PyObject *args, static int ClusterFileReader_init(ClusterFileReader *self, PyObject *args,
PyObject *kwds) { PyObject * Py_UNUSED(kwds)) {
self->fp = NULL; self->fp = NULL;
// Parse file name // Parse file name
@ -96,7 +85,7 @@ ClusterFileReader_dealloc(ClusterFileReader *self)
// read method // read method
static PyObject * static PyObject *
ClusterFileReader_read(ClusterFileReader *self, PyObject *args, ClusterFileReader_read(ClusterFileReader *self, PyObject *args,
PyObject *kwds) PyObject * Py_UNUSED(kwds))
{ {
const int ndim = 1; const int ndim = 1;
@ -147,7 +136,7 @@ ClusterFileReader_read(ClusterFileReader *self, PyObject *args,
// read method // read method
static PyObject * static PyObject *
ClusterFileReader_clusterize(ClusterFileReader *self, PyObject *args, ClusterFileReader_clusterize(ClusterFileReader *self, PyObject *args,
PyObject *kwds) PyObject * Py_UNUSED(kwds))
{ {
@ -229,7 +218,7 @@ static PyMethodDef ClusterFileReader_methods[] = {
{"clusterize", (PyCFunction) ClusterFileReader_clusterize, METH_VARARGS, {"clusterize", (PyCFunction) ClusterFileReader_clusterize, METH_VARARGS,
"Analyze clusters" "Analyze clusters"
}, },
{NULL} /* Sentinel */ {NULL, NULL, 0, NULL} /* Sentinel */
}; };
@ -252,15 +241,18 @@ static PyTypeObject ClusterFileReaderType = {
static char module_docstring[] = static char module_docstring[] =
"C functions to read cluster files"; "C functions to read cluster files";
/* // This is the module itself */ static struct PyModuleDef creader_def = {
/* static PyMethodDef module_methods[] = { */ PyModuleDef_HEAD_INIT, "creader",
/* {"read", (PyCFunction)read, METH_VARARGS, add_doc}, {"decode", (PyCFunction)decode, METH_VARARGS, decode_doc}, */ module_docstring,
/* {NULL, NULL, 0, NULL}}; */ -1,
ClusterFileReader_methods,
NULL, //m_slots
NULL, //m_traverse
NULL, //m_clear
NULL //m_free
};
static struct PyModuleDef creader_def = {PyModuleDef_HEAD_INIT, "creader",
module_docstring, -1, ClusterFileReader_methods};
PyMODINIT_FUNC PyInit_creader(void) { PyMODINIT_FUNC PyInit_creader(void) {
PyObject *m; PyObject *m;
if (PyType_Ready(&ClusterFileReaderType) < 0) if (PyType_Ready(&ClusterFileReaderType) < 0)