API: Add new np.exceptions namespace for errors and warnings#22644
API: Add new np.exceptions namespace for errors and warnings#22644mattip merged 9 commits intonumpy:mainfrom
np.exceptions namespace for errors and warnings#22644Conversation
| .. warning:: | ||
|
|
||
| This warning should not be used, since nose testing is not relvant | ||
| anymore. |
There was a problem hiding this comment.
Added this warning, and skipped documenting it... It seems like a remnant of a time past.
|
Can we please move this (and the other PR there) forward? I (+do not see) potential for controversy or code complexity here, but:
I bet there is more, but my monkey brain can only hold 3 things at once. |
| AxisError Given when an axis was invalid. | ||
| TooHardError Error specific to `numpy.shares_memory`. | ||
|
|
||
| """ |
There was a problem hiding this comment.
Do we have autosummary elsewhere in a module docstring? This feels out of place to me.
There was a problem hiding this comment.
Hmmm, fft and polynomials used it. But I am not sure the autosummary here is actually useful.
There was a problem hiding this comment.
I still think this belongs somewhere else.
| starting with '#' or as specified via `comments`) are not counted | ||
| towards `max_rows`. | ||
| quotechar : unicode character or None, optional | ||
| The character used to denote the start and end of a quoted item. |
There was a problem hiding this comment.
While I agree with the whitespace cleanup in files you are changing anyway, I don't think this one should be part of this PR.
There was a problem hiding this comment.
Oh, not even an actual change left in the end here... (set_module is imported via overrides here, which seemed OKish.)
|
Note that this is still a WIP, might want to change that so it can be merged. |
|
This is still draft status. For other reviewers: it has 3 components:
|
|
I have a separate PR for moving the Yeah can pull out the whitespace changes there, they were not really intended, just auto-stripping by the editor. |
b7dfc6e to
a82a155
Compare
|
Is this ready to go? I quite like it. |
This means moving ComplexWarning, TooHardError, and AxisError.
Both should now live in the "exceptions" module.
AxisError did exist, but e.g. ComplexWarning wasn't even properly included.
|
Should be ready to go now, was missing a rebase on main still. |
numpy/exceptions.py
Outdated
|
|
||
|
|
| convolve : Discrete, linear convolution of two one-dimensional sequences. | ||
| multiarray.correlate : Old, no conjugate, version of correlate. | ||
| scipy.signal.correlate : uses FFT which has superior performance on large arrays. | ||
| scipy.signal.correlate : uses FFT which has superior performance on large arrays. |
There was a problem hiding this comment.
This is tripping up the linter since the line is 85, not 80. But I think it is OK.
Co-authored-by: Matti Picus <matti.picus@gmail.com>
|
Thanks @seberg. There is still the documentation issue, but lets leave that for a future PR. |
Xref numpy#22644 and numpy#22707 Update modules.pyi
This adds the namespace and populates it with the main public exceptions and warnings that we have. I skipped
RankWarningfor now, because we have two (and only one is in the main namespace).The UFuncTypeError is currently effectively private, so did not move it quite yet (this can be a followup).
Based of gh-22619 and thus creating as draft. I put 1.24 as version here, but most likely this will need updating.
The main point of this is really to simplify adding of new exceptions in the future, but I think the module doesn't really hurt even for 3 errors.
Mailing list thread where we discussed adding this module: https://mail.python.org/archives/list/numpy-discussion@python.org/thread/IZJQTPQBKNQGK4OGWSTREQWKGMQDSFKM/