from __future__ import annotations

from ._array_object import Array

from typing import Optional, Tuple, Union

import numpy as np

def max(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
    return Array._new(np.max(x._array, axis=axis, keepdims=keepdims))

def mean(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
    return Array._new(np.asarray(np.mean(x._array, axis=axis, keepdims=keepdims)))

def min(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
    return Array._new(np.min(x._array, axis=axis, keepdims=keepdims))

def prod(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
    return Array._new(np.asarray(np.prod(x._array, axis=axis, keepdims=keepdims)))

def std(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, correction: Union[int, float] = 0.0, keepdims: bool = False) -> Array:
    # Note: the keyword argument correction is different here
    return Array._new(np.asarray(np.std(x._array, axis=axis, ddof=correction, keepdims=keepdims)))

def sum(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> Array:
    return Array._new(np.asarray(np.sum(x._array, axis=axis, keepdims=keepdims)))

def var(x: Array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, correction: Union[int, float] = 0.0, keepdims: bool = False) -> Array:
    # Note: the keyword argument correction is different here
    return Array._new(np.asarray(np.var(x._array, axis=axis, ddof=correction, keepdims=keepdims)))

@@ -443,27 +443,16 @@
 _new(np.
-asarray(np.
 mean(x._
@@ -484,25 +484,24 @@
 s=keepdims))
-)
 %0A%0Adef min(x:
@@ -807,27 +807,16 @@
 _new(np.
-asarray(np.
 prod(x._
@@ -848,25 +848,24 @@
 s=keepdims))
-)
 %0A%0Adef std(x:
@@ -1088,27 +1088,16 @@
 _new(np.
-asarray(np.
 std(x._a
@@ -1145,25 +1145,24 @@
 s=keepdims))
-)
 %0A%0Adef sum(x:
@@ -1286,27 +1286,16 @@
 _new(np.
-asarray(np.
 sum(x._a
@@ -1330,17 +1330,16 @@
 epdims))
-)
 %0A%0Adef va
@@ -1570,19 +1570,8 @@
 (np.
-asarray(np.
 var(
@@ -1627,10 +1627,9 @@
 epdims))
-)
 %0A

Remove asarray() calls from the array API statistical functions