Skip to content

Commit

Permalink
Merge pull request #19311 from BvB93/notimplemented
Browse files Browse the repository at this point in the history
REV,BUG: Replace `NotImplemented` with `typing.Any`
  • Loading branch information
charris committed Jun 23, 2021
2 parents 1cfefdf + 4ebcc2b commit 209cca9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions numpy/typing/__init__.py
Expand Up @@ -161,7 +161,7 @@
# NOTE: The API section will be appended with additional entries
# further down in this file

from typing import TYPE_CHECKING, List
from typing import TYPE_CHECKING, List, Any

if TYPE_CHECKING:
import sys
Expand Down Expand Up @@ -364,14 +364,14 @@ class _8Bit(_16Bit): ... # type: ignore[misc]
_GUFunc_Nin2_Nout1,
)
else:
_UFunc_Nin1_Nout1 = NotImplemented
_UFunc_Nin2_Nout1 = NotImplemented
_UFunc_Nin1_Nout2 = NotImplemented
_UFunc_Nin2_Nout2 = NotImplemented
_GUFunc_Nin2_Nout1 = NotImplemented
_UFunc_Nin1_Nout1 = Any
_UFunc_Nin2_Nout1 = Any
_UFunc_Nin1_Nout2 = Any
_UFunc_Nin2_Nout2 = Any
_GUFunc_Nin2_Nout1 = Any

# Clean up the namespace
del TYPE_CHECKING, final, List
del TYPE_CHECKING, final, List, Any

if __doc__ is not None:
from ._add_docstring import _docstrings
Expand Down
26 changes: 13 additions & 13 deletions numpy/typing/_extended_precision.py
Expand Up @@ -4,7 +4,7 @@
that they can be imported conditionally via the numpy's mypy plugin.
"""

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

import numpy as np
from . import (
Expand All @@ -28,15 +28,15 @@
complex256 = np.complexfloating[_128Bit, _128Bit]
complex512 = np.complexfloating[_256Bit, _256Bit]
else:
uint128 = NotImplemented
uint256 = NotImplemented
int128 = NotImplemented
int256 = NotImplemented
float80 = NotImplemented
float96 = NotImplemented
float128 = NotImplemented
float256 = NotImplemented
complex160 = NotImplemented
complex192 = NotImplemented
complex256 = NotImplemented
complex512 = NotImplemented
uint128 = Any
uint256 = Any
int128 = Any
int256 = Any
float80 = Any
float96 = Any
float128 = Any
float256 = Any
complex160 = Any
complex192 = Any
complex256 = Any
complex512 = Any
4 changes: 2 additions & 2 deletions numpy/typing/_shape.py
@@ -1,13 +1,13 @@
import sys
from typing import Sequence, Tuple, Union
from typing import Sequence, Tuple, Union, Any

if sys.version_info >= (3, 8):
from typing import SupportsIndex
else:
try:
from typing_extensions import SupportsIndex
except ImportError:
SupportsIndex = NotImplemented
SupportsIndex = Any

_Shape = Tuple[int, ...]

Expand Down
4 changes: 2 additions & 2 deletions numpy/typing/tests/test_generic_alias.py
Expand Up @@ -21,8 +21,8 @@
NDArray_ref = types.GenericAlias(np.ndarray, (Any, DType_ref))
FuncType = Callable[[Union[_GenericAlias, types.GenericAlias]], Any]
else:
DType_ref = NotImplemented
NDArray_ref = NotImplemented
DType_ref = Any
NDArray_ref = Any
FuncType = Callable[[_GenericAlias], Any]

GETATTR_NAMES = sorted(set(dir(np.ndarray)) - _GenericAlias._ATTR_EXCEPTIONS)
Expand Down

0 comments on commit 209cca9

Please sign in to comment.