Skip to content

Commit 94c8688

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7ce1122 commit 94c8688

19 files changed

Lines changed: 161 additions & 245 deletions

File tree

cupynumeric/_array/array.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,9 +2285,7 @@ def _diag_helper(
22852285
res_dtype = (
22862286
dtype
22872287
if dtype is not None
2288-
else out.dtype
2289-
if out is not None
2290-
else a.dtype
2288+
else out.dtype if out is not None else a.dtype
22912289
)
22922290
a = a._maybe_convert(res_dtype, (a,))
22932291
if out is not None and out.shape != out_shape:

cupynumeric/_module/ssc_searching.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ def flatnonzero(a: ndarray) -> ndarray:
197197

198198

199199
@overload
200-
def where(a: npt.ArrayLike | ndarray, x: None, y: None) -> tuple[ndarray, ...]:
201-
...
200+
def where(
201+
a: npt.ArrayLike | ndarray, x: None, y: None
202+
) -> tuple[ndarray, ...]: ...
202203

203204

204205
@overload
205206
def where(
206207
a: npt.ArrayLike | ndarray,
207208
x: npt.ArrayLike | ndarray,
208209
y: npt.ArrayLike | ndarray,
209-
) -> ndarray:
210-
...
210+
) -> ndarray: ...
211211

212212

213213
@add_boilerplate("a", "x", "y") # type: ignore [misc]

cupynumeric/_thunk/deferred.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ def decorator(func: Callable[P, R]) -> Callable[P, R]:
142142
def wrapper(*args: Any, **kwargs: Any) -> R:
143143
# Convert relevant arguments to DeferredArrays
144144
args = tuple(
145-
runtime.to_deferred_array(arg, read_only=True)
146-
if idx in indices and arg is not None
147-
else arg
145+
(
146+
runtime.to_deferred_array(arg, read_only=True)
147+
if idx in indices and arg is not None
148+
else arg
149+
)
148150
for (idx, arg) in enumerate(args)
149151
)
150152
for k, v in kwargs.items():

cupynumeric/_thunk/eager.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,17 +1467,21 @@ def unary_op(
14671467
func(
14681468
rhs.array,
14691469
out=self.array,
1470-
where=where
1471-
if not isinstance(where, EagerArray)
1472-
else where.array,
1470+
where=(
1471+
where
1472+
if not isinstance(where, EagerArray)
1473+
else where.array
1474+
),
14731475
)
14741476
else:
14751477
func(
14761478
rhs.array,
14771479
out=(self.array, *(out.array for out in multiout)),
1478-
where=where
1479-
if not isinstance(where, EagerArray)
1480-
else where.array,
1480+
where=(
1481+
where
1482+
if not isinstance(where, EagerArray)
1483+
else where.array
1484+
),
14811485
)
14821486
elif op == UnaryOpCode.CLIP:
14831487
np.clip(
@@ -1549,9 +1553,9 @@ def unary_reduction(
15491553
out=self.array,
15501554
axis=orig_axis,
15511555
keepdims=keepdims,
1552-
where=where
1553-
if not isinstance(where, EagerArray)
1554-
else where.array,
1556+
where=(
1557+
where if not isinstance(where, EagerArray) else where.array
1558+
),
15551559
**kws,
15561560
)
15571561
elif op == UnaryRedCode.SUM_SQUARES:
@@ -1560,9 +1564,9 @@ def unary_reduction(
15601564
squared,
15611565
out=self.array,
15621566
axis=orig_axis,
1563-
where=where
1564-
if not isinstance(where, EagerArray)
1565-
else where.array,
1567+
where=(
1568+
where if not isinstance(where, EagerArray) else where.array
1569+
),
15661570
keepdims=keepdims,
15671571
)
15681572
elif op == UnaryRedCode.VARIANCE:
@@ -1572,9 +1576,9 @@ def unary_reduction(
15721576
np.sum(
15731577
squares,
15741578
axis=orig_axis,
1575-
where=where
1576-
if not isinstance(where, EagerArray)
1577-
else where.array,
1579+
where=(
1580+
where if not isinstance(where, EagerArray) else where.array
1581+
),
15781582
keepdims=keepdims,
15791583
out=self.array,
15801584
)
@@ -1619,9 +1623,9 @@ def binary_op(
16191623
rhs1.array,
16201624
rhs2.array,
16211625
out=self.array,
1622-
where=where
1623-
if not isinstance(where, EagerArray)
1624-
else where.array,
1626+
where=(
1627+
where if not isinstance(where, EagerArray) else where.array
1628+
),
16251629
)
16261630

16271631
def binary_reduction(

0 commit comments

Comments
 (0)