Skip to content

Commit b0eed55

Browse files
ev-brcrusaderky
andcommitted
Apply suggestions from code review
Co-authored-by: Guido Imperiale <[email protected]>
1 parent 118ae2d commit b0eed55

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

array_api_compat/numpy/_aliases.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,20 @@ def take_along_axis(x: Array, indices: Array, /, *, axis: int = -1):
145145
# ceil, floor, and trunc return integers for integer inputs in NumPy < 2
146146

147147
def ceil(x: Array, /) -> Array:
148-
if np.issubdtype(x.dtype, np.integer):
149-
if np.__version__ < '2':
150-
return x.copy()
148+
if np.__version__ < '2' and np.issubdtype(x.dtype, np.integer):
149+
return x.copy()
151150
return np.ceil(x)
152151

153152

154153
def floor(x: Array, /) -> Array:
155-
if np.issubdtype(x.dtype, np.integer):
156-
if np.__version__ < '2':
157-
return x.copy()
154+
if np.__version__ < '2' and np.issubdtype(x.dtype, np.integer):
155+
return x.copy()
158156
return np.floor(x)
159157

160158

161159
def trunc(x: Array, /) -> Array:
162-
if np.issubdtype(x.dtype, np.integer):
163-
if np.__version__ < '2':
164-
return x.copy()
160+
if np.__version__ < '2' and np.issubdtype(x.dtype, np.integer):
161+
return x.copy()
165162
return np.trunc(x)
166163

167164

0 commit comments

Comments
 (0)