Skip to content
Browse files

None isn't comparable to ints in python 3

  • Loading branch information...
1 parent ae6791e commit dd7a2b103dee377ad4ef633c7ceab95056975e90 @dougalsutherland dougalsutherland committed Apr 26, 2012
View
2 bottleneck/src/template/func/nanmax.py
@@ -324,7 +324,7 @@ def nanmax_selector(arr, axis):
a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/nanmean.py
@@ -316,7 +316,7 @@ def nanmean_selector(arr, axis):
a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/nanmin.py
@@ -324,7 +324,7 @@ def nanmin_selector(arr, axis):
a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/nanstd.py
@@ -410,7 +410,7 @@ def nanstd_selector(arr, axis):
a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/nansum.py
@@ -300,7 +300,7 @@ def nansum_selector(arr, axis):
if dtype < NPY_int_:
a = a.astype(np.int_)
dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/nanvar.py
@@ -410,7 +410,7 @@ def nanvar_selector(arr, axis):
a = np.array(arr, copy=False)
cdef int ndim = PyArray_NDIM(a)
cdef int dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
2 bottleneck/src/template/func/ss.py
@@ -203,7 +203,7 @@ def ss_selector(arr, axis):
if dtype < NPY_int_:
a = a.astype(np.int_)
dtype = PyArray_TYPE(a)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
axis += ndim
cdef tuple key = (ndim, dtype, axis)
try:
View
4 bottleneck/src/template/template.py
@@ -169,7 +169,7 @@ def looper(loop, ndim, axis):
if ndim < 1:
raise ValueError("ndim(=%d) must be and integer greater than 0" % ndim)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
raise ValueError("`axis` must be a non-negative integer or None")
if axis >= ndim:
raise ValueError("`axis` must be less then `ndim`")
@@ -300,7 +300,7 @@ def loop_cdef(ndim, dtype, axis, is_reducing_function, cdef_output=True):
if ndim < 1:
raise ValueError("ndim(=%d) must be and integer greater than 0" % ndim)
- if (axis < 0) and (axis is not None):
+ if (axis is not None) and (axis < 0):
raise ValueError("`axis` must be a non-negative integer or None")
if axis >= ndim:
raise ValueError("`axis` must be less then `ndim`")

0 comments on commit dd7a2b1

Please sign in to comment.
Something went wrong with that request. Please try again.