Skip to content

Commit

Permalink
MAINT: Remove npt._GenericAlias in favor of py39 types.GenericAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
BvB93 committed Feb 2, 2023
1 parent c4c5232 commit cc5aaf2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 440 deletions.
6 changes: 1 addition & 5 deletions numpy/_typing/__init__.py
Expand Up @@ -180,6 +180,7 @@ class _8Bit(_16Bit): # type: ignore[misc]
_DTypeLikeComplex_co as _DTypeLikeComplex_co,
)
from ._array_like import (
NDArray as NDArray,
ArrayLike as ArrayLike,
_ArrayLike as _ArrayLike,
_FiniteNestedSequence as _FiniteNestedSequence,
Expand All @@ -201,11 +202,6 @@ class _8Bit(_16Bit): # type: ignore[misc]
_ArrayLikeUnknown as _ArrayLikeUnknown,
_UnknownType as _UnknownType,
)
from ._generic_alias import (
NDArray as NDArray,
_DType as _DType,
_GenericAlias as _GenericAlias,
)

if TYPE_CHECKING:
from ._ufunc import (
Expand Down
2 changes: 1 addition & 1 deletion numpy/_typing/_add_docstring.py
Expand Up @@ -3,7 +3,7 @@
import re
import textwrap

from ._generic_alias import NDArray
from ._array_like import NDArray

_docstrings_list = []

Expand Down
3 changes: 3 additions & 0 deletions numpy/_typing/_array_like.py
Expand Up @@ -23,9 +23,12 @@

_T = TypeVar("_T")
_ScalarType = TypeVar("_ScalarType", bound=generic)
_ScalarType_co = TypeVar("_ScalarType_co", bound=generic, covariant=True)
_DType = TypeVar("_DType", bound=dtype[Any])
_DType_co = TypeVar("_DType_co", covariant=True, bound=dtype[Any])

NDArray = ndarray[Any, dtype[_ScalarType_co]]

# The `_SupportsArray` protocol only cares about the default dtype
# (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned
# array.
Expand Down
2 changes: 1 addition & 1 deletion numpy/_typing/_callable.pyi
Expand Up @@ -43,7 +43,7 @@ from ._scalars import (
_NumberLike_co,
)
from . import NBitBase
from ._generic_alias import NDArray
from ._array_like import NDArray
from ._nested_sequence import _NestedSequence

_T1 = TypeVar("_T1")
Expand Down
245 changes: 0 additions & 245 deletions numpy/_typing/_generic_alias.py

This file was deleted.

0 comments on commit cc5aaf2

Please sign in to comment.