-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
TYPING: _64Bit
reported as incompatible with NBitBase
#24569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here's two more examples, the second of which is also flagged by from numpy import int64, integer
from numpy._typing import _64Bit
from numpy.typing import NBitBase, NDArray
a: NDArray[integer[_64Bit]]
b: NDArray[integer[NBitBase]]
b = a
IMAGE_TYPE: type[integer[NBitBase]] = int64
The key seems to be that
https://numpy.org/devdocs/reference/typing.html#number-precision |
After having thought about this for a while, I think that I might need to use a |
Ah, so the documentation didn't get updated back then. The variance of the As for your example: like any other type with an invariant parameter I'd resort to using |
Describe the issue:
mypy
reports an error in the following code. Comparingndarray[Any, dtype[signedinteger[_64Bit]]]
andndarray[Any, dtype[signedinteger[NBitBase]]]
, the only difference seems to be_64Bit
vs.NBitBase
- although the former is a subclass of the latter:numpy/numpy/_typing/__init__.py
Lines 67 to 80 in a277f62
Reproduce the code example:
Error message:
Runtime information:
1.25.2
3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
Context for the issue:
I had to choose between reporting this at
mypy
or here first. Hope I made a decent choice, but I am happy to report elsewhere as well.The text was updated successfully, but these errors were encountered: