Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Added hint for ndarray.__new__ #29

Merged
merged 1 commit into from
Jul 7, 2019
Merged

Added hint for ndarray.__new__ #29

merged 1 commit into from
Jul 7, 2019

Conversation

bedder
Copy link
Contributor

@bedder bedder commented Jun 7, 2019

numpy.ndarray.__new__ previously did not have any type definitions, meaning that code that directly instantiates np.ndarray instances would be flagged by mypy as having unexpected arguments.

I think this should fix the issue - at the very least this change removes what I consider to be invalid warnings on my codebase - although I'm unsure about whether the type for the buffer is correct.

@shoyer
Copy link
Member

shoyer commented Jul 7, 2019

There seems to be a bigger issue about defining buffer types (python/typing#593), but this seems like a good start.

Thanks @bedder !

@shoyer shoyer merged commit a57ec56 into numpy:master Jul 7, 2019
@bedder
Copy link
Contributor Author

bedder commented Jul 8, 2019

Thanks to everyone working on this project - it's a really useful addition to numpy!

At my work we've ended up creating a public fork of this project, and have slowly been adding type hints for more of the numpy library. If it would be useful to yourselves (and not too spammy), we'd be happy to raise more PRs for the additions we've been using internally.

@shoyer
Copy link
Member

shoyer commented Jul 8, 2019 via email

@shoyer
Copy link
Member

shoyer commented Jul 8, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants