-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
signal
: Add type stubs to _spectral_py.pyi
.
#157
Conversation
In `_spectral_py.pyi`.
In `_spectral_py.pyi`.
In `_spectral_py.pyi`. The `lombscargle` stubs are not up to date with the latest dev branch of scipy.
In `_spectral_py.pyi`.
This is because of the overloads.
In `_spectral_py.pyi`.
From the module `signal`.
In `_spectral_py.pyi`.
0d3ff4a
to
cc8f55a
Compare
signal
: Add type stubs to _spectral_py.pyi
.
Yea, that'll be in the
Yea good catch. This is not the first time that the docs are incorrect unfortunately. And I agree with you judgement call here, because as stated in our code of conduct:
Yea it's usually better to avoid guessing the return type, and go with the "safe" option. Plus, shape-typing is somewhere at the bottom of the (hypothetical) priority list, so no worries. |
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.
Nice job on the type-tests! I should probably do that more often as well haha.
I left a couple of small suggestions, but in general this looks very good to me 👌🏻.
I think all the issues should be addressed now. |
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.
Apart from an issue with float128
and complex256
(which is actually more of an issue with numpy), I'm be happy to merge this; the other comments I leave up to your judgement.
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
In `_spectral_py.pyi` to be backwards compatible with numpy<2. Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
In `_spectral_py.pyi` to be backwards compatible. Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
In `_spectral_py.pyi`.
Good now? |
Thanks again, @pavyamsiri 😄 |
@pavyamsiri Do you think that the "phase" of |
Contributes to completing #99.
I added type stubs to the stub file
signal/_spectral_py.pyi
and tests for the function overloads I added.Caveats
I discovered that the function
lombscargle
was recently updated to include new parameters which also expands the possible return types (see PR scipy/scipy#21277). It also adds inline type stubs which might be an issue.I did not type stub against this new version though because I think it is still in the dev branch and is not part of a release.
Also I saw that the function
periodogram
's docs don't specify thatNone
is allowed for the argumentwindow
but the body explicitly checks forNone
. Therefore I allowedNone
to be passed in as well. This is a bit annoying because the type annotation is no longer consistent with otherwindow
arguments in other functions.I could have perhaps used more shaped typing but its a bit hard to verify because the functions are a bit complex, so I just left things as any shape.