-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
ENH: Add annotations for five array construction functions #17326
Conversation
) -> ndarray: ... | ||
@overload | ||
def asanyarray( | ||
a: _ArrayType, |
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.
def(a: _ArrayType, ...) -> _ArrayType
implies that both the array (sub-)class, dtype and shape are identical for the input and output.
Without higher-kindred typevars (python/typing#548) we, unfortunately, can not describe a situation were an ndarray
subclass is returned with a dtype that is different from the initial input (hence the dtype: None
in this overload).
Rebased to get rid of a merge conflict. |
71def2c implements an alternative approach for ensuring that externally-defined stubs are |
Objects defined in an external file will be picked up if they are either specified in `__all__` or imported as `import x as x`. The latter notation is more compact and is less prone to merge conflicts.
Thanks @BvB93 . |
This pull request adds annotations to the five array construction functions in
np.core._asarray
:asarray
asanyarray
ascontiguousarray
asfortranarray
require