diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2020-10-06 13:40:39 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2020-10-06 13:40:39 +0200 |
commit | d934c2620439cbcf9b6f19b6037c1c67346dd71f (patch) | |
tree | 9bca65631a36c84124e8675f2929446858663def | |
parent | cb92195c59be15415ce795367aeac6619f069257 (diff) | |
download | numpy-d934c2620439cbcf9b6f19b6037c1c67346dd71f.tar.gz |
REV: Remove the `uint64`/`signedinteger` specific overload
Unfortunately the likes of `self: uint64` don't work with protocols.
Revisit this once we add proper support for numerical precision.
-rw-r--r-- | numpy/typing/_callable.py | 7 | ||||
-rw-r--r-- | numpy/typing/tests/data/fail/bitwise_ops.py | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py index 943441cf4..194522977 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.py @@ -9,7 +9,7 @@ See the `Mypy documentation`_ on protocols for more details. """ import sys -from typing import Union, TypeVar, overload, Any, NoReturn +from typing import Union, TypeVar, overload, Any from numpy import ( _BoolLike, @@ -26,7 +26,6 @@ from numpy import ( signedinteger, int32, int64, - uint64, floating, float32, float64, @@ -114,14 +113,12 @@ if HAVE_PROTOCOL: def __call__(self, __other: complex) -> complexfloating[floating]: ... class _UnsignedIntBitOp(Protocol): - # The likes of `uint64 | np.signedinteger` will fail as there + # TODO: The likes of `uint64 | np.signedinteger` will fail as there # is no signed integer type large enough to hold a `uint64` # See https://github.com/numpy/numpy/issues/2524 @overload def __call__(self, __other: Union[bool, unsignedinteger]) -> unsignedinteger: ... @overload - def __call__(self: uint64, __other: Union[int, signedinteger]) -> NoReturn: ... - @overload def __call__(self, __other: Union[int, signedinteger]) -> signedinteger: ... class _SignedIntOp(Protocol): diff --git a/numpy/typing/tests/data/fail/bitwise_ops.py b/numpy/typing/tests/data/fail/bitwise_ops.py index 9be6869ad..3b5be95c0 100644 --- a/numpy/typing/tests/data/fail/bitwise_ops.py +++ b/numpy/typing/tests/data/fail/bitwise_ops.py @@ -15,5 +15,6 @@ i8 ^ f8 # E: incompatible type u8 & f8 # E: No overload variant ~f8 # E: Unsupported operand type -# mypys' error message for `NoReturn` is unfortunately pretty nad -a = u8 | 0 # E: Need type annotation +# mypys' error message for `NoReturn` is unfortunately pretty bad +# TODO: Reenable this once we add support for numerical precision for `number`s +# a = u8 | 0 # E: Need type annotation |