Skip to content

Commit 98717f0

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 93993ee commit 98717f0

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

include/eigenpy/numpy-allocator.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ struct numpy_allocator_impl_matrix<Eigen::Ref<MatType, Options, Stride> > {
141141
#if NPY_ABI_VERSION < 0x02000000
142142
const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize;
143143
#else
144-
const int elsize = PyDataType_ELSIZE(call_PyArray_DescrFromType(Scalar_type_code));
144+
const int elsize =
145+
PyDataType_ELSIZE(call_PyArray_DescrFromType(Scalar_type_code));
145146
#endif
146147
npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride};
147148

@@ -211,7 +212,8 @@ struct numpy_allocator_impl_matrix<
211212
#if NPY_ABI_VERSION < 0x02000000
212213
const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize;
213214
#else
214-
const int elsize = PyDataType_ELSIZE(call_PyArray_DescrFromType(Scalar_type_code));
215+
const int elsize =
216+
PyDataType_ELSIZE(call_PyArray_DescrFromType(Scalar_type_code));
215217
#endif
216218
npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride};
217219

include/eigenpy/numpy.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#endif
1818

1919
/* Allow compiling against NumPy 1.x and 2.x
20-
see: https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224
20+
see:
21+
https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224
2122
*/
2223
#if NPY_ABI_VERSION < 0x02000000
2324
#define PyArray_DescrProto PyArray_Descr
@@ -27,18 +28,16 @@
2728
#include <numpy/ufuncobject.h>
2829

2930
#if NPY_ABI_VERSION < 0x02000000
30-
static inline PyArray_ArrFuncs *
31-
PyDataType_GetArrFuncs(PyArray_Descr *descr)
32-
{
33-
return descr->f;
34-
}
31+
static inline PyArray_ArrFuncs* PyDataType_GetArrFuncs(PyArray_Descr* descr) {
32+
return descr->f;
33+
}
3534
#endif
3635

3736
/* PEP 674 disallow using macros as l-values
3837
see : https://peps.python.org/pep-0674/
3938
*/
4039
#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
41-
static inline void _Py_SET_TYPE(PyObject *o, PyTypeObject *type) {
40+
static inline void _Py_SET_TYPE(PyObject* o, PyTypeObject* type) {
4241
Py_TYPE(o) = type;
4342
}
4443
#define Py_SET_TYPE(o, type) _Py_SET_TYPE((PyObject*)(o), type)

include/eigenpy/user-type.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ struct SpecialMethods<T, NPY_USERDEF> {
171171
char* srcptr = static_cast<char*>(src);
172172

173173
PyArrayObject* py_array = static_cast<PyArrayObject*>(array);
174-
PyArray_CopySwapFunc* copyswap = PyDataType_GetArrFuncs(PyArray_DESCR(py_array))->copyswap;
174+
PyArray_CopySwapFunc* copyswap =
175+
PyDataType_GetArrFuncs(PyArray_DESCR(py_array))->copyswap;
175176

176177
for (npy_intp i = 0; i < n; i++) {
177178
copyswap(dstptr, srcptr, swap, array);
@@ -189,8 +190,8 @@ struct SpecialMethods<T, NPY_USERDEF> {
189190
return (npy_bool)(value != ZeroValue);
190191
} else {
191192
T tmp_value;
192-
PyDataType_GetArrFuncs(PyArray_DESCR(py_array))->copyswap(
193-
&tmp_value, ip, PyArray_ISBYTESWAPPED(py_array), array);
193+
PyDataType_GetArrFuncs(PyArray_DESCR(py_array))
194+
->copyswap(&tmp_value, ip, PyArray_ISBYTESWAPPED(py_array), array);
194195
return (npy_bool)(tmp_value != ZeroValue);
195196
}
196197
}

src/numpy.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ void import_numpy() {
1414
}
1515

1616
int PyArray_TypeNum(PyTypeObject* type) {
17-
PyArray_Descr * descr = PyArray_DescrFromTypeObject(reinterpret_cast<PyObject*>(type));
17+
PyArray_Descr* descr =
18+
PyArray_DescrFromTypeObject(reinterpret_cast<PyObject*>(type));
1819
if (descr == NULL) {
19-
return NPY_NOTYPE;
20+
return NPY_NOTYPE;
2021
}
2122
return descr->type_num;
2223
}

0 commit comments

Comments
 (0)