-
Notifications
You must be signed in to change notification settings - Fork 775
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
fix(numpy): numpy
annotation processing
#4795
Conversation
For more information, see https://pre-commit.ci
Hmmm... looks like Python 3.8 isn't happy. Will look into it. |
I think I got to the bottom of this. There is some weirdness in how |
For more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
What does this PR address?
Currently, it seems to me that
numpy
annotations are broken. For example, neither of the correct typesnpt.NDArray[np.float32]
ornp.ndarray[Any, np.dtype[np.float32]],
are processed and instead result in errors.These changes fix this and add to the unit tests to catch regressions. Additionally, I've made sure that if the type hint for a Numpy array doesn't match the
Annotated
DType
then we throw an error.I'm really surprised how little unit testing there is in this area - am I missing something?
Fixes #(issue)
Before submitting:
guide on how to create a pull request.
pre-commit run -a
script has passed (instructions)?those accordingly? Here are documentation guidelines and tips on writting docs.