10
10
AxisLike ,
11
11
DTypeLike ,
12
12
NDArray ,
13
+ OutArray ,
13
14
SubokLike ,
14
15
normalizer ,
15
16
)
@@ -41,11 +42,11 @@ def clip(
41
42
min : Optional [ArrayLike ] = None ,
42
43
max : Optional [ArrayLike ] = None ,
43
44
out : Optional [NDArray ] = None ,
44
- ):
45
+ ) -> OutArray :
45
46
# np.clip requires both a_min and a_max not None, while ndarray.clip allows
46
47
# one of them to be None. Follow the more lax version.
47
48
result = _impl .clip (a , min , max )
48
- return _helpers . result_or_out ( result , out )
49
+ return result , out
49
50
50
51
51
52
@normalizer
@@ -78,9 +79,9 @@ def trace(
78
79
axis2 = 1 ,
79
80
dtype : DTypeLike = None ,
80
81
out : Optional [NDArray ] = None ,
81
- ):
82
+ ) -> OutArray :
82
83
result = _impl .trace (a , offset , axis1 , axis2 , dtype )
83
- return _helpers . result_or_out ( result , out )
84
+ return result , out
84
85
85
86
86
87
@normalizer
@@ -133,9 +134,9 @@ def vdot(a: ArrayLike, b: ArrayLike, /):
133
134
134
135
135
136
@normalizer
136
- def dot (a : ArrayLike , b : ArrayLike , out : Optional [NDArray ] = None ):
137
+ def dot (a : ArrayLike , b : ArrayLike , out : Optional [NDArray ] = None ) -> OutArray :
137
138
result = _impl .dot (a , b )
138
- return _helpers . result_or_out ( result , out )
139
+ return result , out
139
140
140
141
141
142
# ### sort and partition ###
@@ -232,9 +233,9 @@ def imag(a: ArrayLike):
232
233
233
234
234
235
@normalizer
235
- def round_ (a : ArrayLike , decimals = 0 , out : Optional [NDArray ] = None ):
236
+ def round_ (a : ArrayLike , decimals = 0 , out : Optional [NDArray ] = None ) -> OutArray :
236
237
result = _impl .round (a , decimals )
237
- return _helpers . result_or_out ( result , out )
238
+ return result , out
238
239
239
240
240
241
around = round_
@@ -253,11 +254,11 @@ def sum(
253
254
keepdims = NoValue ,
254
255
initial = NoValue ,
255
256
where = NoValue ,
256
- ):
257
+ ) -> OutArray :
257
258
result = _impl .sum (
258
259
a , axis = axis , dtype = dtype , initial = initial , where = where , keepdims = keepdims
259
260
)
260
- return _helpers . result_or_out ( result , out )
261
+ return result , out
261
262
262
263
263
264
@normalizer
@@ -269,11 +270,11 @@ def prod(
269
270
keepdims = NoValue ,
270
271
initial = NoValue ,
271
272
where = NoValue ,
272
- ):
273
+ ) -> OutArray :
273
274
result = _impl .prod (
274
275
a , axis = axis , dtype = dtype , initial = initial , where = where , keepdims = keepdims
275
276
)
276
- return _helpers . result_or_out ( result , out )
277
+ return result , out
277
278
278
279
279
280
product = prod
@@ -288,9 +289,9 @@ def mean(
288
289
keepdims = NoValue ,
289
290
* ,
290
291
where = NoValue ,
291
- ):
292
+ ) -> OutArray :
292
293
result = _impl .mean (a , axis = axis , dtype = dtype , where = NoValue , keepdims = keepdims )
293
- return _helpers . result_or_out ( result , out )
294
+ return result , out
294
295
295
296
296
297
@normalizer
@@ -303,11 +304,11 @@ def var(
303
304
keepdims = NoValue ,
304
305
* ,
305
306
where = NoValue ,
306
- ):
307
+ ) -> OutArray :
307
308
result = _impl .var (
308
309
a , axis = axis , dtype = dtype , ddof = ddof , where = where , keepdims = keepdims
309
310
)
310
- return _helpers . result_or_out ( result , out )
311
+ return result , out
311
312
312
313
313
314
@normalizer
@@ -320,11 +321,11 @@ def std(
320
321
keepdims = NoValue ,
321
322
* ,
322
323
where = NoValue ,
323
- ):
324
+ ) -> OutArray :
324
325
result = _impl .std (
325
326
a , axis = axis , dtype = dtype , ddof = ddof , where = where , keepdims = keepdims
326
327
)
327
- return _helpers . result_or_out ( result , out )
328
+ return result , out
328
329
329
330
330
331
@normalizer
@@ -334,9 +335,9 @@ def argmin(
334
335
out : Optional [NDArray ] = None ,
335
336
* ,
336
337
keepdims = NoValue ,
337
- ):
338
+ ) -> OutArray :
338
339
result = _impl .argmin (a , axis = axis , keepdims = keepdims )
339
- return _helpers . result_or_out ( result , out )
340
+ return result , out
340
341
341
342
342
343
@normalizer
@@ -346,9 +347,9 @@ def argmax(
346
347
out : Optional [NDArray ] = None ,
347
348
* ,
348
349
keepdims = NoValue ,
349
- ):
350
+ ) -> OutArray :
350
351
result = _impl .argmax (a , axis = axis , keepdims = keepdims )
351
- return _helpers . result_or_out ( result , out )
352
+ return result , out
352
353
353
354
354
355
@normalizer
@@ -359,9 +360,9 @@ def amax(
359
360
keepdims = NoValue ,
360
361
initial = NoValue ,
361
362
where = NoValue ,
362
- ):
363
+ ) -> OutArray :
363
364
result = _impl .max (a , axis = axis , initial = initial , where = where , keepdims = keepdims )
364
- return _helpers . result_or_out ( result , out )
365
+ return result , out
365
366
366
367
367
368
max = amax
@@ -375,9 +376,9 @@ def amin(
375
376
keepdims = NoValue ,
376
377
initial = NoValue ,
377
378
where = NoValue ,
378
- ):
379
+ ) -> OutArray :
379
380
result = _impl .min (a , axis = axis , initial = initial , where = where , keepdims = keepdims )
380
- return _helpers . result_or_out ( result , out )
381
+ return result , out
381
382
382
383
383
384
min = amin
@@ -386,9 +387,9 @@ def amin(
386
387
@normalizer
387
388
def ptp (
388
389
a : ArrayLike , axis : AxisLike = None , out : Optional [NDArray ] = None , keepdims = NoValue
389
- ):
390
+ ) -> OutArray :
390
391
result = _impl .ptp (a , axis = axis , keepdims = keepdims )
391
- return _helpers . result_or_out ( result , out )
392
+ return result , out
392
393
393
394
394
395
@normalizer
@@ -399,9 +400,9 @@ def all(
399
400
keepdims = NoValue ,
400
401
* ,
401
402
where = NoValue ,
402
- ):
403
+ ) -> OutArray :
403
404
result = _impl .all (a , axis = axis , where = where , keepdims = keepdims )
404
- return _helpers . result_or_out ( result , out )
405
+ return result , out
405
406
406
407
407
408
@normalizer
@@ -412,9 +413,9 @@ def any(
412
413
keepdims = NoValue ,
413
414
* ,
414
415
where = NoValue ,
415
- ):
416
+ ) -> OutArray :
416
417
result = _impl .any (a , axis = axis , where = where , keepdims = keepdims )
417
- return _helpers . result_or_out ( result , out )
418
+ return result , out
418
419
419
420
420
421
@normalizer
@@ -429,9 +430,9 @@ def cumsum(
429
430
axis : AxisLike = None ,
430
431
dtype : DTypeLike = None ,
431
432
out : Optional [NDArray ] = None ,
432
- ):
433
+ ) -> OutArray :
433
434
result = _impl .cumsum (a , axis = axis , dtype = dtype )
434
- return _helpers . result_or_out ( result , out )
435
+ return result , out
435
436
436
437
437
438
@normalizer
@@ -440,9 +441,9 @@ def cumprod(
440
441
axis : AxisLike = None ,
441
442
dtype : DTypeLike = None ,
442
443
out : Optional [NDArray ] = None ,
443
- ):
444
+ ) -> OutArray :
444
445
result = _impl .cumprod (a , axis = axis , dtype = dtype )
445
- return _helpers . result_or_out ( result , out )
446
+ return result , out
446
447
447
448
448
449
cumproduct = cumprod
@@ -459,7 +460,7 @@ def quantile(
459
460
keepdims = False ,
460
461
* ,
461
462
interpolation = None ,
462
- ):
463
+ ) -> OutArray :
463
464
result = _impl .quantile (
464
465
a ,
465
466
q ,
@@ -469,10 +470,10 @@ def quantile(
469
470
keepdims = keepdims ,
470
471
interpolation = interpolation ,
471
472
)
472
- return _helpers . result_or_out ( result , out , promote_scalar = True )
473
+ return result , out
473
474
474
475
475
- @normalizer
476
+ @normalizer ( promote_scalar_result = True )
476
477
def percentile (
477
478
a : ArrayLike ,
478
479
q : ArrayLike ,
@@ -483,7 +484,7 @@ def percentile(
483
484
keepdims = False ,
484
485
* ,
485
486
interpolation = None ,
486
- ):
487
+ ) -> OutArray :
487
488
result = _impl .percentile (
488
489
a ,
489
490
q ,
@@ -493,7 +494,7 @@ def percentile(
493
494
keepdims = keepdims ,
494
495
interpolation = interpolation ,
495
496
)
496
- return _helpers . result_or_out ( result , out , promote_scalar = True )
497
+ return result , out
497
498
498
499
499
500
def median (
0 commit comments