Skip to content

Commit d83ff6b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 8a9f0e7 commit d83ff6b

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: 2 additions & 1 deletion
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

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: 7 additions & 8 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
}
@@ -25,18 +26,16 @@ int PyArray_TypeNum(PyTypeObject* type) {
2526
see : https://peps.python.org/pep-0674/
2627
*/
2728
#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
28-
static inline void _Py_SET_TYPE(PyObject *o, PyTypeObject *type) {
29+
static inline void _Py_SET_TYPE(PyObject* o, PyTypeObject* type) {
2930
Py_TYPE(o) = type;
3031
}
3132
#define Py_SET_TYPE(o, type) _Py_SET_TYPE((PyObject*)(o), type)
3233
#endif
3334

3435
#if NPY_ABI_VERSION < 0x02000000
35-
static inline PyArray_ArrFuncs *
36-
PyDataType_GetArrFuncs(PyArray_Descr *descr)
37-
{
38-
return descr->f;
39-
}
36+
static inline PyArray_ArrFuncs* PyDataType_GetArrFuncs(PyArray_Descr* descr) {
37+
return descr->f;
38+
}
4039
#endif
4140

4241
#if defined _WIN32 || defined __CYGWIN__

0 commit comments

Comments
 (0)