Skip to content

Commit bf66cd1

Browse files
authored
optype.numpy.CanArrayND: remove scalar type parameter default (#354)
2 parents 3745a95 + a0b79fc commit bf66cd1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

optype/numpy/_array.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __dir__() -> list[str]:
3535
_DTT_co = TypeVar("_DTT_co", bound=np.dtype[Any], default=np.dtype[Any], covariant=True)
3636
_SCT = TypeVar("_SCT", bound=np.generic, default=Any)
3737
_SCT_co = TypeVar("_SCT_co", bound=np.generic, default=Any, covariant=True)
38+
_SCT0_co = TypeVar("_SCT0_co", bound=np.generic, covariant=True)
3839

3940

4041
Matrix = TypeAliasType(
@@ -115,14 +116,14 @@ def __array__(self, /) -> np.ndarray[_NDT_co, _DTT_co]: ...
115116

116117
@runtime_checkable
117118
@set_module("optype.numpy")
118-
class CanArrayND(Protocol[_SCT_co, _NDT_co]):
119+
class CanArrayND(Protocol[_SCT0_co, _NDT_co]):
119120
"""
120121
Similar to `onp.CanArray`, but must be sized (i.e. excludes scalars), and is
121122
parameterized by only the scalar type (instead of the shape and dtype).
122123
"""
123124

124125
def __len__(self, /) -> int: ...
125-
def __array__(self, /) -> np.ndarray[_NDT_co, np.dtype[_SCT_co]]: ...
126+
def __array__(self, /) -> np.ndarray[_NDT_co, np.dtype[_SCT0_co]]: ...
126127

127128

128129
Array0D = TypeAliasType(

0 commit comments

Comments
 (0)