diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-01-20 16:11:17 -0700 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-01-20 16:11:17 -0700 |
commit | be1b1932f73fb5946b4867337ba2fd2d31964d11 (patch) | |
tree | 8a05934e452a13c9b6f93ffa238809f90104c777 /numpy/_array_api/_utility_functions.py | |
parent | df698f80732508af50b24ecc1b4bd34c470aaba8 (diff) | |
download | numpy-be1b1932f73fb5946b4867337ba2fd2d31964d11.tar.gz |
Add type annotations to the array api submodule function definitions
Some stubs still need to be modified to properly pass mypy type checking.
Also, 'device' is just left as a TypeVar() for now.
Diffstat (limited to 'numpy/_array_api/_utility_functions.py')
-rw-r--r-- | numpy/_array_api/_utility_functions.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/_array_api/_utility_functions.py b/numpy/_array_api/_utility_functions.py index 19743d15c..69e17e0e5 100644 --- a/numpy/_array_api/_utility_functions.py +++ b/numpy/_array_api/_utility_functions.py @@ -1,6 +1,10 @@ +from __future__ import annotations + +from ._types import Optional, Tuple, Union, array + import numpy as np -def all(x, /, *, axis=None, keepdims=False): +def all(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> array: """ Array API compatible wrapper for :py:func:`np.all <numpy.all>`. @@ -8,7 +12,7 @@ def all(x, /, *, axis=None, keepdims=False): """ return np.all(x, axis=axis, keepdims=keepdims) -def any(x, /, *, axis=None, keepdims=False): +def any(x: array, /, *, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False) -> array: """ Array API compatible wrapper for :py:func:`np.any <numpy.any>`. |