diff options
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 23 | ||||
-rw-r--r-- | numpy/lib/src/_compiled_base.c | 34 |
2 files changed, 29 insertions, 28 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 6bee30797..22b700af8 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -740,7 +740,7 @@ static int get_ufunc_arguments(PyUFuncObject *ufunc, *out_use_maskna = 0; /* Get input arguments */ - for(i = 0; i < nin; ++i) { + for (i = 0; i < nin; ++i) { obj = PyTuple_GET_ITEM(args, i); if (!PyArray_Check(obj) && !PyArray_IsScalar(obj, Generic)) { /* @@ -985,7 +985,7 @@ static int get_ufunc_arguments(PyUFuncObject *ufunc, */ if (*out_use_maskna && any_non_maskna_out) { /* Check all the inputs for NA */ - for(i = 0; i < nin; ++i) { + for (i = 0; i < nin; ++i) { if (PyArray_HASMASKNA(out_op[i])) { int containsna = PyArray_ContainsNA(out_op[i], NULL, NULL); if (containsna == -1) { @@ -3678,7 +3678,7 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc, PyObject *args, if (operation == UFUNC_REDUCEAT) { PyArray_Descr *indtype; indtype = PyArray_DescrFromType(PyArray_INTP); - if(!PyArg_ParseTupleAndKeywords(args, kwds, "OO|OO&O&i", kwlist2, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|OO&O&i", kwlist2, &op, &obj_ind, &axes_in, @@ -3696,7 +3696,7 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc, PyObject *args, } } else if (operation == UFUNC_ACCUMULATE) { - if(!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&ii", kwlist1, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&ii", kwlist1, &op, &axes_in, PyArray_DescrConverter2, &otype, @@ -3708,7 +3708,7 @@ PyUFunc_GenericReduction(PyUFuncObject *ufunc, PyObject *args, } } else { - if(!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&ii", kwlist1, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO&O&ii", kwlist1, &op, &axes_in, PyArray_DescrConverter2, &otype, @@ -4093,7 +4093,7 @@ ufunc_generic_call(PyUFuncObject *ufunc, PyObject *args, PyObject *kwds) * Initialize all array objects to NULL to make cleanup easier * if something goes wrong. */ - for(i = 0; i < ufunc->nargs; i++) { + for (i = 0; i < ufunc->nargs; i++) { mps[i] = NULL; } @@ -4672,7 +4672,7 @@ ufunc_outer(PyUFuncObject *ufunc, PyObject *args, PyObject *kwds) return NULL; } - if(ufunc->nin != 2) { + if (ufunc->nin != 2) { PyErr_SetString(PyExc_ValueError, "outer product only supported "\ "for binary functions"); @@ -4835,12 +4835,13 @@ ufunc_get_doc(PyUFuncObject *ufunc) outargs = _makeargs(ufunc->nout, "out", 1); inargs = _makeargs(ufunc->nin, "x", 0); - if(ufunc->doc == NULL){ - if(outargs == NULL){ + if (ufunc->doc == NULL) { + if (outargs == NULL) { doc = PyUString_FromFormat("%s(%s)\n\n", ufunc->name, PyString_AS_STRING(inargs)); - }else{ + } + else { doc = PyUString_FromFormat("%s(%s[, %s])\n\n", ufunc->name, PyString_AS_STRING(inargs), @@ -4848,7 +4849,7 @@ ufunc_get_doc(PyUFuncObject *ufunc) Py_DECREF(outargs); } } - else{ + else { if (outargs == NULL) { doc = PyUString_FromFormat("%s(%s)\n\n%s", ufunc->name, diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c index 155f29033..dd8cea16b 100644 --- a/numpy/lib/src/_compiled_base.c +++ b/numpy/lib/src/_compiled_base.c @@ -402,7 +402,7 @@ arr_insert(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) /* compute indx into input array */ rem_indx = mindx; indx = 0; - for(i = nd - 1; i > 0; --i) { + for (i = nd - 1; i > 0; --i) { indx += (rem_indx % inshape[i]) * instrides[i]; rem_indx /= inshape[i]; } @@ -646,35 +646,35 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims, j = *(npy_intp *)coords[i]; switch (modes[i]) { case NPY_RAISE: - if(j < 0 || j>=m) { + if (j < 0 || j >= m) { PyErr_SetString(PyExc_ValueError, "invalid entry in coordinates array"); return NPY_FAIL; } break; case NPY_WRAP: - if(j < 0) { + if (j < 0) { j += m; - if(j < 0) { - j = j%m; - if(j != 0) { + if (j < 0) { + j = j % m; + if (j != 0) { j += m; } } } - else if(j >= m) { + else if (j >= m) { j -= m; - if(j >= m) { - j = j%m; + if (j >= m) { + j = j % m; } } break; case NPY_CLIP: - if(j < 0) { + if (j < 0) { j = 0; } - else if(j >= m) { - j = m-1; + else if (j >= m) { + j = m - 1; } break; @@ -713,7 +713,7 @@ arr_ravel_multi_index(PyObject *self, PyObject *args, PyObject *kwds) memset(op, 0, sizeof(op)); dtype[0] = NULL; - if(!PyArg_ParseTupleAndKeywords(args, kwds, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&|OO&:ravel_multi_index", kwlist, &coords0, PyArray_IntpConverter, &dimensions, @@ -728,7 +728,7 @@ arr_ravel_multi_index(PyObject *self, PyObject *args, PyObject *kwds) goto fail; } - if(!PyArray_ConvertClipmodeSequence(mode0, modes, dimensions.len)) { + if (!PyArray_ConvertClipmodeSequence(mode0, modes, dimensions.len)) { goto fail; } @@ -902,7 +902,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds) char *kwlist[] = {"indices", "dims", "order", NULL}; - if(!PyArg_ParseTupleAndKeywords(args, kwds, "OO&|O&:unravel_index", + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&|O&:unravel_index", kwlist, &indices0, PyArray_IntpConverter, &dimensions, @@ -918,10 +918,10 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds) unravel_size = PyArray_MultiplyList(dimensions.ptr, dimensions.len); - if(!PyArray_Check(indices0)) { + if (!PyArray_Check(indices0)) { indices = (PyArrayObject*)PyArray_FromAny(indices0, NULL, 0, 0, 0, NULL); - if(indices == NULL) { + if (indices == NULL) { goto fail; } } |