| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Move them into a new `numpy/typing/tests directory`
|
|\ |
|
| |\
| | |
| | | |
ENH: Add annotations to 3 functions in `np.core.function_base`
|
| | | |
|
| | |
| | |
| | |
| | | |
Co-Authored-By: Eric Wieser <eric-wieser@users.noreply.github.com>
|
| | | |
|
| |\ \
| | | |
| | | | |
MAINT: Fix various issues with the `np.generic` annotations
|
| | | |
| | | |
| | | |
| | | | |
Addresses https://github.com/numpy/numpy/pull/17214#discussion_r481239468
|
| | | |
| | | |
| | | |
| | | | |
See https://bugs.python.org/issue20092
|
| | | | |
|
| | | | |
|
| | | | |
|
| |\ \ \
| | | | |
| | | | | |
ENH: Add placeholder stubs for all sub-modules
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | |/
| | |/| |
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Using `np.random` can cause mysterious test failures in mypy `api.run`
with a report that 'error: Module has no attribute "rand"'. The fix
here is to use `np.empty` instead of `np.random.rand`. Why this works
is unknown at present.
|
| |/
|/|
| |
| |
| |
| |
| |
| | |
* MAINT: Added missing methods to `np.flatiter`
* DOC: Added a comment about weird `flatiter.__getitem__` behavior
Contrary to `ndarray.__getitem__` its counterpart in `flatiter` does not accept objects with the `__array__` or `__index__` protocols;
boolean indexing is just plain broken (gh-17175)
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added annotations for 8 new functions
The 8 respective functions, all located in `np.core.fromnumeric`, consist of:
* `prod`
* `cumprod`
* `ndim`
* `size`
* `around`
* `mean`
* `std`
* `var`
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
|
|
|
|
|
| |
This pull requests addresses and implement two previous TODO's in `np.typing._DTypeLike`:
* Added a protocol, `_SupportsDtype`, for objects with the `dtype` attribute.
* Replaced an old dictionary, representing array field parameter, with a `TypedDict`.
|
|
|
|
|
|
|
| |
* MAINT: Added the `order` argument to `np.array()`
* MAINT: Made a number of `np.array()` arguments keyword-only
* TST: Added a `np.array` test with >2 positional arguments
|
|
|
|
|
|
|
| |
Affected generic subclasses:
* `floating`
* `complexfloating`
* `datetime64`
|
|
|
|
|
|
|
|
|
|
|
|
| |
Newly annotated functions:
* `clip`
* `sum`
* `all`
* `any`
* `cumsum`
* `ptp`
* `amax`
* `amin`
|
|
|
| |
`numpy.abs` is alias of `numpy.absolute`. I added its type annotation.
|
|
|
|
| |
See #16612
|
|\
| |
| | |
ENH: make typing module available at runtime
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Closes https://github.com/numpy/numpy/issues/16550.
This makes `np.typing.ArrayLike` and `np.typing.DtypeLike` available
at runtime in addition to typing time. Some things to consider:
- `ArrayLike` uses protocols, which are only in the standard library
in 3.8+, but are backported in `typing_extensions`. This
conditionally imports `Protocol` and sets `_SupportsArray` to `Any`
at runtime if the module is not available to prevent NumPy from
having a hard dependency on `typing_extensions`. Since e.g. mypy
already includes `typing_extensions` as a dependency, anybody
actually doing type checking will have it set correctly.
- We are starting to hit the edges of "the fiction of the stubs". In
particular, they could just cram everything into `__init__.pyi` and
ignore the real structure of NumPy. But now that typing is available
a runtime, we have to e.g. carefully import `ndarray` from `numpy`
in the typing module and not from `..core.multiarray`, because
otherwise mypy will think you are talking about a different
ndarray. We will probably need to do some shuffling the stubs into
more fitting locations to mitigate weirdness like this.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Closes https://github.com/numpy/numpy/issues/16577.
Make the arguments of `np.generic` constructors positional-only.
Also fix the constructor of`np.bytes_`: encoding is only
supported when supplied a string. The opposite holds for
`np.str_`.
|
| |
| |
| |
| |
| | |
The first parameter to the constructor is currently called "obj",
which is incorrect. It should instead be "dtype".
|
|/
|
|
|
|
| |
Simplified annotations for functions requiring >=1D ArrayLike
objects. Affects a set of <20 functions from
``np.core.fromnumeric``. Based on feedback from
https://github.com/numpy/numpy-stubs/pull/71.
|
| |
|
| |
|
|
|