We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
np.ndarray.__class_getitem__
npt.NDArray
1 parent 49f5358 commit 0baeeb1Copy full SHA for 0baeeb1
numpy/typing/_generic_alias.py
@@ -205,12 +205,9 @@ def __getattribute__(self, name: str) -> Any:
205
206
ScalarType = TypeVar("ScalarType", bound=np.generic, covariant=True)
207
208
-if TYPE_CHECKING:
+if TYPE_CHECKING or sys.version_info >= (3, 9):
209
_DType = np.dtype[ScalarType]
210
NDArray = np.ndarray[Any, np.dtype[ScalarType]]
211
-elif sys.version_info >= (3, 9):
212
- _DType = types.GenericAlias(np.dtype, (ScalarType,))
213
- NDArray = types.GenericAlias(np.ndarray, (Any, _DType))
214
else:
215
_DType = _GenericAlias(np.dtype, (ScalarType,))
216
NDArray = _GenericAlias(np.ndarray, (Any, _DType))
0 commit comments