@@ -152,7 +152,8 @@ cdef extern from "numpy/arrayobject.h":
152
152
153
153
npy_intp NPY_MAX_ELSIZE
154
154
155
- ctypedef void (* PyArray_VectorUnaryFunc)(void * , void * , npy_intp, void * , void * )
155
+ ctypedef void (* PyArray_VectorUnaryFunc)(
156
+ void * , void * , npy_intp, void * , void * )
156
157
157
158
ctypedef class numpy.dtype [object PyArray_Descr]:
158
159
# Use PyDataType_* macros when possible, however there are no macros
@@ -225,7 +226,9 @@ cdef extern from "numpy/arrayobject.h":
225
226
if copy_shape:
226
227
# Allocate new buffer for strides and shape info.
227
228
# This is allocated as one block, strides first.
228
- info.strides = < Py_ssize_t* > stdlib.malloc(sizeof(Py_ssize_t) * < size_t> ndim * 2 )
229
+ info.strides = < Py_ssize_t* > stdlib.malloc(
230
+ sizeof(Py_ssize_t) * < size_t> ndim * 2 )
231
+
229
232
info.shape = info.strides + ndim
230
233
for i in range (ndim):
231
234
info.strides[i] = PyArray_STRIDES(self )[i]
@@ -275,7 +278,8 @@ cdef extern from "numpy/arrayobject.h":
275
278
elif t == NPY_CLONGDOUBLE: f = " Zg"
276
279
elif t == NPY_OBJECT: f = " O"
277
280
else :
278
- raise ValueError (u " unknown dtype code in numpy.pxd (%d )" % t)
281
+ raise ValueError (
282
+ u " unknown dtype code in numpy.pxd (%d )" % t)
279
283
info.format = f
280
284
return
281
285
else :
@@ -294,7 +298,6 @@ cdef extern from "numpy/arrayobject.h":
294
298
stdlib.free(info.strides)
295
299
# info.shape was stored after info.strides in the same block
296
300
297
-
298
301
ctypedef signed char npy_bool
299
302
300
303
ctypedef signed char npy_byte
@@ -462,7 +465,6 @@ cdef extern from "numpy/arrayobject.h":
462
465
bint PyArray_ISBEHAVED(ndarray)
463
466
bint PyArray_ISBEHAVED_RO(ndarray)
464
467
465
-
466
468
bint PyDataType_ISNOTSWAPPED(dtype)
467
469
bint PyDataType_ISBYTESWAPPED(dtype)
468
470
@@ -475,7 +477,6 @@ cdef extern from "numpy/arrayobject.h":
475
477
# bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
476
478
# bint PyArray_HasArrayInterface(op, out)
477
479
478
-
479
480
bint PyArray_IsZeroDim(object )
480
481
# Cannot be supported due to ## ## in macro:
481
482
# bint PyArray_IsScalar(object, verbatim work)
@@ -502,24 +503,28 @@ cdef extern from "numpy/arrayobject.h":
502
503
unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
503
504
bint PyArray_EquivByteorders(int b1, int b2)
504
505
object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
505
- object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void * data)
506
+ object PyArray_SimpleNewFromData(int nd, npy_intp* dims,
507
+ int typenum, void * data)
506
508
# object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
507
509
object PyArray_ToScalar(void * data, ndarray arr)
508
510
509
511
void * PyArray_GETPTR1(ndarray m, npy_intp i)
510
512
void * PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j)
511
513
void * PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k)
512
- void * PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l)
514
+ void * PyArray_GETPTR4(ndarray m, npy_intp i,
515
+ npy_intp j, npy_intp k, npy_intp l)
513
516
514
517
void PyArray_XDECREF_ERR(ndarray)
515
518
# Cannot be supported due to out arg
516
519
# void PyArray_DESCR_REPLACE(descr)
517
520
518
-
519
521
object PyArray_Copy(ndarray)
520
- object PyArray_FromObject(object op, int type , int min_depth, int max_depth)
521
- object PyArray_ContiguousFromObject(object op, int type , int min_depth, int max_depth)
522
- object PyArray_CopyFromObject(object op, int type , int min_depth, int max_depth)
522
+ object PyArray_FromObject(object op, int type ,
523
+ int min_depth, int max_depth)
524
+ object PyArray_ContiguousFromObject(object op, int type ,
525
+ int min_depth, int max_depth)
526
+ object PyArray_CopyFromObject(object op, int type ,
527
+ int min_depth, int max_depth)
523
528
524
529
object PyArray_Cast(ndarray mp, int type_num)
525
530
object PyArray_Take(ndarray ap, object items, int axis)
@@ -598,8 +603,8 @@ cdef extern from "numpy/arrayobject.h":
598
603
object PyArray_Dumps (object , int )
599
604
int PyArray_ValidType (int )
600
605
void PyArray_UpdateFlags (ndarray, int )
601
- object PyArray_New (type , int , npy_intp * , int , npy_intp * , void * , int , int , object )
602
- # object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
606
+ object PyArray_New (type , int , npy_intp * , int , npy_intp * ,
607
+ void * , int , int , object )
603
608
# dtype PyArray_DescrNew (dtype)
604
609
dtype PyArray_DescrNewFromType (int )
605
610
double PyArray_GetPriority (object , double )
@@ -611,7 +616,8 @@ cdef extern from "numpy/arrayobject.h":
611
616
int PyArray_Broadcast (broadcast)
612
617
void PyArray_FillObjectArray (ndarray, object )
613
618
int PyArray_FillWithScalar (ndarray, object )
614
- npy_bool PyArray_CheckStrides (int , int , npy_intp, npy_intp, npy_intp * , npy_intp * )
619
+ npy_bool PyArray_CheckStrides (
620
+ int , int , npy_intp, npy_intp, npy_intp * , npy_intp * )
615
621
dtype PyArray_DescrNewByteorder (dtype, char )
616
622
object PyArray_IterAllButAxis (object , int * )
617
623
# object PyArray_CheckFromAny (object, dtype, int, int, int, object)
@@ -782,9 +788,11 @@ cdef inline object PyArray_MultiIterNew4(a, b, c, d):
782
788
return PyArray_MultiIterNew(4 , < void * > a, < void * > b, < void * > c, < void * > d)
783
789
784
790
cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
785
- return PyArray_MultiIterNew(5 , < void * > a, < void * > b, < void * > c, < void * > d, < void * > e)
791
+ return PyArray_MultiIterNew(5 , < void * > a, < void * > b,
792
+ < void * > c, < void * > d, < void * > e)
786
793
787
- cdef inline char * _util_dtypestring(dtype descr, char * f, char * end, int * offset) except NULL :
794
+ cdef inline char * _util_dtypestring(dtype descr, char * f,
795
+ char * end, int * offset) except NULL :
788
796
# Recursive utility function used in __getbuffer__ to get format
789
797
# string. The new location in the format string is returned.
790
798
@@ -800,7 +808,8 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset
800
808
child, new_offset = fields
801
809
802
810
if (end - f) - (new_offset - offset[0 ]) < 15 :
803
- raise RuntimeError (u " Format string allocated too short, see comment in numpy.pxd" )
811
+ raise RuntimeError (
812
+ u " Format string allocated too short, see comment in numpy.pxd" )
804
813
805
814
if ((child.byteorder == ' >' and little_endian) or
806
815
(child.byteorder == ' <' and not little_endian)):
@@ -860,7 +869,8 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset
860
869
861
870
cdef extern from " numpy/ufuncobject.h" :
862
871
863
- ctypedef void (* PyUFuncGenericFunction) (char ** , npy_intp * , npy_intp * , void * )
872
+ ctypedef void (* PyUFuncGenericFunction) (char ** , npy_intp * ,
873
+ npy_intp * , void * )
864
874
865
875
ctypedef extern class numpy.ufunc [object PyUFuncObject]:
866
876
cdef:
@@ -968,14 +978,14 @@ cdef extern from "numpy/ufuncobject.h":
968
978
969
979
970
980
cdef inline void set_array_base(ndarray arr, object base):
971
- cdef PyObject* baseptr
972
- if base is None :
973
- baseptr = NULL
974
- else :
975
- Py_INCREF(base) # important to do this before decref below!
976
- baseptr = < PyObject* > base
977
- Py_XDECREF(arr.base)
978
- arr.base = baseptr
981
+ cdef PyObject* baseptr
982
+ if base is None :
983
+ baseptr = NULL
984
+ else :
985
+ Py_INCREF(base) # important to do this before decref below!
986
+ baseptr = < PyObject* > base
987
+ Py_XDECREF(arr.base)
988
+ arr.base = baseptr
979
989
980
990
cdef inline object get_array_base(ndarray arr):
981
991
if arr.base is NULL :
0 commit comments