-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
BUG, DOC, TYP: empty and zeros runtime signatures, and missing device parameter docs
#30140
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
Conversation
empty and zeros runtime signaturesempty and zeros runtime signatures
empty and zeros runtime signaturesempty and zeros runtime signatures, and missing device parameter docs
empty and zeros runtime signatures, and missing device parameter docsempty and zeros runtime signatures, and missing device parameter docs
|
Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code: xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_namedarray.py: note: In member "test_from_array_with_0d_object" of class "TestNamedArray":
+ xarray/tests/test_namedarray.py:249: error: Need type annotation for "narr" [var-annotated]
|
|
the primer error is a bit weird, but it's not an indiciation of a regression or something. Basically "need type annotations" means that mypy isn't able to infer the type itself, but in many cases where it also can't infer the type, mypy doesn't report this error. |
| add_newdoc('numpy._core.multiarray', 'empty', | ||
| """ | ||
| empty(shape, dtype=float, order='C', *, device=None, like=None) | ||
| empty(shape, dtype=None, order='C', *, device=None, like=None) |
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.
Hmm, python does pass None here, but that defaults to float64. I guess this is more accurate.
|
Thanks Joren. |
This fixes `inspect.signature` for - `np.random.BitGenerator` - `np.random.Generator` - `np.random.MT19937` - `np.random.PCG64` - `np.random.PCG64DXSM` - `np.random.Philox` - `np.random.RandomState` - `np.random.SFC64` - `np.random.SeedSequence` - `np.random.bit_generator.SeedlessSeedSequence` This also fixes a typo in `bit_generator.pxd` that accidentally defined an empty unused class `np.random.bit_generator.SeedlessSequence`. Related to #30104, #30114, #30121, #30124, #30126, #30137, #30138, #30140, #30143, #30146, #30147, and #30155
…g ``device`` parameter docs (numpy#30140) * BUG: ``empty`` and ``zeros`` runtime signatures * TYP: `empty`, `zeros`, and `ones` parameter defaults and minor shape-type fix * TST: Update `_convert2ma` test signature for `np.ma.empty`
This fixes `inspect.signature` for - `np.random.BitGenerator` - `np.random.Generator` - `np.random.MT19937` - `np.random.PCG64` - `np.random.PCG64DXSM` - `np.random.Philox` - `np.random.RandomState` - `np.random.SFC64` - `np.random.SeedSequence` - `np.random.bit_generator.SeedlessSeedSequence` This also fixes a typo in `bit_generator.pxd` that accidentally defined an empty unused class `np.random.bit_generator.SeedlessSequence`. Related to numpy#30104, numpy#30114, numpy#30121, numpy#30124, numpy#30126, numpy#30137, numpy#30138, numpy#30140, numpy#30143, numpy#30146, numpy#30147, and numpy#30155
…g ``device`` parameter docs (numpy#30140) * BUG: ``empty`` and ``zeros`` runtime signatures * TYP: `empty`, `zeros`, and `ones` parameter defaults and minor shape-type fix * TST: Update `_convert2ma` test signature for `np.ma.empty`
This fixes `inspect.signature` for - `np.random.BitGenerator` - `np.random.Generator` - `np.random.MT19937` - `np.random.PCG64` - `np.random.PCG64DXSM` - `np.random.Philox` - `np.random.RandomState` - `np.random.SFC64` - `np.random.SeedSequence` - `np.random.bit_generator.SeedlessSeedSequence` This also fixes a typo in `bit_generator.pxd` that accidentally defined an empty unused class `np.random.bit_generator.SeedlessSequence`. Related to numpy#30104, numpy#30114, numpy#30121, numpy#30124, numpy#30126, numpy#30137, numpy#30138, numpy#30140, numpy#30143, numpy#30146, numpy#30147, and numpy#30155
Following #30104, #30114, #30121, #30124, #30126, #30137, and #30138; this adds the missing
__text_signature__s toempty,zeros, and updates the relevant stubs.Note that because
onesandfullare python functions, they did not have this issue.This also adds docs for the
deviceparameter ofzeros, which apparently was missing.Before:
After: