Skip to content

Commit e455f80

Browse files
committed
🩹 remove numpy and add _MatmulScalarT
1 parent cf0f0db commit e455f80

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎src/numpy-stubs/__init__.pyi

+7-8
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ from typing import (
2727
)
2828
from typing_extensions import Buffer, CapsuleType, LiteralString, Never, Protocol, Self, TypeVar, Unpack, deprecated, override
2929

30-
import numpy as np
31-
3230
from . import (
3331
__config__ as __config__,
3432
_array_api_info as _array_api_info,
@@ -590,6 +588,7 @@ _IntegerT = TypeVar("_IntegerT", bound=integer)
590588
_SignedIntegerT = TypeVar("_SignedIntegerT", bound=signedinteger)
591589
_UnsignedIntegerT = TypeVar("_UnsignedIntegerT", bound=unsignedinteger)
592590
_CharT = TypeVar("_CharT", bound=character)
591+
_MatmulScalarT = TypeVar("_MatmulScalarT", bound=bool_ | number | object_)
593592

594593
_NBitT = TypeVar("_NBitT", bound=NBitBase, default=Any)
595594
_NBitT1 = TypeVar("_NBitT1", bound=NBitBase, default=Any)
@@ -613,7 +612,7 @@ _DT64ItemT = TypeVar("_DT64ItemT", bound=dt.date | int | None)
613612
_DT64ItemT_co = TypeVar("_DT64ItemT_co", bound=dt.date | int | None, default=dt.date | int | None, covariant=True)
614613
_TD64UnitT = TypeVar("_TD64UnitT", bound=_TD64Unit, default=_TD64Unit)
615614

616-
_Array1D: TypeAlias = np.ndarray[tuple[int], np.dtype[_ScalarT]]
615+
_Array1D: TypeAlias = ndarray[tuple[int], dtype[_ScalarT]]
617616

618617
###
619618
# Type Aliases (for internal use only)
@@ -2534,8 +2533,10 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
25342533
def __imul__(self: NDArray[complexfloating], rhs: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
25352534
@overload
25362535
def __imul__(self: NDArray[object_], rhs: object, /) -> ndarray[_ShapeT_co, _DTypeT_co]: ...
2536+
2537+
#
25372538
@overload
2538-
def __matmul__(self: _Array1D[_ScalarT], rhs: _Array1D[_ScalarT], /) -> _ScalarT: ...
2539+
def __matmul__(self: _Array1D[_MatmulScalarT], rhs: _Array1D[_MatmulScalarT], /) -> _MatmulScalarT: ...
25392540
@overload
25402541
def __matmul__(self: NDArray[_NumberT], rhs: _ArrayLikeBool_co, /) -> NDArray[_NumberT]: ...
25412542
@overload
@@ -2569,14 +2570,12 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
25692570
@overload
25702571
def __matmul__(self: NDArray[bool_ | number], rhs: _ArrayLikeNumber_co, /) -> NDArray[Incomplete]: ...
25712572
@overload
2572-
def __matmul__(self: NDArray[object_], rhs: _ArrayLikeObject_co, /) -> NDArray[object_]: ...
2573+
def __matmul__(self: NDArray[object_], rhs: object, /) -> NDArray[object_]: ...
25732574
@overload
25742575
def __matmul__(self, rhs: _ArrayLikeObject_co, /) -> NDArray[object_]: ...
25752576

25762577
# keep in sync with __matmul__
25772578
@overload
2578-
def __rmatmul__(self: _Array1D[_ScalarT], rhs: _Array1D[_ScalarT], /) -> _ScalarT: ...
2579-
@overload
25802579
def __rmatmul__(self: NDArray[_NumberT], lhs: _ArrayLikeBool_co, /) -> NDArray[_NumberT]: ...
25812580
@overload
25822581
def __rmatmul__(self: NDArray[bool_], lhs: _ArrayLike[_NumberT], /) -> NDArray[_NumberT]: ...
@@ -2609,7 +2608,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
26092608
@overload
26102609
def __rmatmul__(self: NDArray[bool_ | number], lhs: _ArrayLikeNumber_co, /) -> NDArray[Incomplete]: ...
26112610
@overload
2612-
def __rmatmul__(self: NDArray[object_], lhs: _ArrayLikeObject_co, /) -> NDArray[object_]: ...
2611+
def __rmatmul__(self: NDArray[object_], lhs: object, /) -> NDArray[object_]: ...
26132612
@overload
26142613
def __rmatmul__(self, lhs: _ArrayLikeObject_co, /) -> NDArray[object_]: ...
26152614

0 commit comments

Comments
 (0)