Skip to content

Commit 610f64f

Browse files
committed
💥 use Rank2 as np.matrix shape default
1 parent 022d81a commit 610f64f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/numpy-stubs/matrixlib/defmatrix.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ __all__ = ["asmatrix", "bmat", "matrix"]
1616
_T = TypeVar("_T")
1717
_ArrayT = TypeVar("_ArrayT", bound=_nt.Array)
1818
_ScalarT = TypeVar("_ScalarT", bound=np.generic)
19-
_ShapeT_co = TypeVar("_ShapeT_co", bound=_nt.Shape2, default=_nt.Shape2, covariant=True)
19+
_ShapeT_co = TypeVar("_ShapeT_co", bound=_nt.Shape2, default=_nt.Rank2, covariant=True)
2020
_DTypeT_co = TypeVar("_DTypeT_co", bound=np.dtype, default=np.dtype, covariant=True)
2121

2222
_ToIndex1: TypeAlias = slice | EllipsisType | _nt.ToInteger_1nd | None
@@ -38,9 +38,9 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]):
3838
@overload
3939
def __getitem__(self, key: _ToIndex1 | _ToIndex2, /) -> matrix[_nt.Rank2, _DTypeT_co]: ...
4040
@overload
41-
def __getitem__(self: _nt.Array[np.void], key: str, /) -> matrix[_ShapeT_co, np.dtype]: ...
41+
def __getitem__(self: _nt.Array[np.void], key: str, /) -> _nt.Matrix: ...
4242
@overload
43-
def __getitem__(self: _nt.Array[np.void], key: list[str], /) -> matrix[_ShapeT_co, np.dtype[np.void]]: ... # pyright: ignore[reportIncompatibleMethodOverride]
43+
def __getitem__(self: _nt.Array[np.void], key: list[str], /) -> _nt.Matrix[np.void]: ... # pyright: ignore[reportIncompatibleMethodOverride]
4444

4545
#
4646
@override

0 commit comments

Comments
 (0)