diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-10-09 13:03:44 +0200 |
---|---|---|
committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-10-12 15:57:43 +0200 |
commit | 25fb2de8512bc066961fa566c1cc84477dfbb579 (patch) | |
tree | a41eb5c18f5848a251cdcc334fe229795fe750e1 /numpy/matrixlib | |
parent | 8c9cf7954b6afe3bf94ff0971398cc23817d38ef (diff) | |
download | numpy-25fb2de8512bc066961fa566c1cc84477dfbb579.tar.gz |
ENH: Add annotations for `np.matrix`
Diffstat (limited to 'numpy/matrixlib')
-rw-r--r-- | numpy/matrixlib/__init__.pyi | 12 | ||||
-rw-r--r-- | numpy/matrixlib/defmatrix.pyi | 15 |
2 files changed, 22 insertions, 5 deletions
diff --git a/numpy/matrixlib/__init__.pyi b/numpy/matrixlib/__init__.pyi index 26453f000..c1b82d2ec 100644 --- a/numpy/matrixlib/__init__.pyi +++ b/numpy/matrixlib/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import List from numpy._pytesttester import PytestTester @@ -6,10 +6,12 @@ from numpy import ( matrix as matrix, ) +from numpy.matrixlib.defmatrix import ( + bmat as bmat, + mat as mat, + asmatrix as asmatrix, +) + __all__: List[str] __path__: List[str] test: PytestTester - -def bmat(obj, ldict=..., gdict=...): ... -def asmatrix(data, dtype=...): ... -mat = asmatrix diff --git a/numpy/matrixlib/defmatrix.pyi b/numpy/matrixlib/defmatrix.pyi new file mode 100644 index 000000000..6c86ea1ef --- /dev/null +++ b/numpy/matrixlib/defmatrix.pyi @@ -0,0 +1,15 @@ +from typing import List, Any, Sequence, Mapping +from numpy import matrix as matrix +from numpy.typing import ArrayLike, DTypeLike, NDArray + +__all__: List[str] + +def bmat( + obj: str | Sequence[ArrayLike] | NDArray[Any], + ldict: None | Mapping[str, Any] = ..., + gdict: None | Mapping[str, Any] = ..., +) -> matrix[Any, Any]: ... + +def asmatrix(data: ArrayLike, dtype: DTypeLike = ...) -> matrix[Any, Any]: ... + +mat = asmatrix |