| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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: enable multi-platform SIMD compiler optimizations
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implement new distutils class `CCompilerOpt`, used for handling
the CPU/hardware optimization, starting from parsing the
command arguments, to managing the relationship between the CPU baseline
and dispatch-able features, also generating the required C headers
and ending with compiling the sources with proper compiler's flags.
`CCompilerOpt` mainly used as a helper class for `CCompiler`,
and doesn't provide any runtime detection for the CPU features,
instead only focuses on the compiler side, but it generates
abstract C headers that can be used later for the final
runtime dispatching process.
|
|\ \
| | |
| | | |
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.
|
|\ \ \
| | | |
| | | | |
DEP: Deprecate aliases of builtin types in python 3.7+
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This:
* Makes accessing these attributes emit a deprecation warning
* Removes them from `dir(numpy)`, so as not to emit warnings for user of `inspect.getmembers`
These aliases are a continual source of confusion for beginners, and are still often used by accident by experts.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
|
| |
|
|
|
|
| |
It currently splits on ":", which causes problems with drives.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the type stubs and tests from numpy-stubs. Things this entails:
- Copy over the stubs (numpy/__init__.pyi and
numpy/core/_internal.pyi)
- The only modification made was removing `ndarray.tostring` since
it is deprecated
- Update some setup.py files to include pyi files
- Move the tests from numpy-stubs/tests into numpy/tests
- Skip them if mypy is not installed (planning on setting up CI in a
future PR)
- Add a mypy.ini; use it to configure mypy in the tests
- It tells mypy where to find NumPy in the test env
- It ignores internal NumPy type errors (since we only want to
consider errors from the tests cases)
- Some small edits were made to fix test cases that were emitting
deprecation warnings
- Add numpy/py.typed so that the types are picked up in an
installed version of NumPy
|
|
|
|
|
|
|
| |
This is technically not a bug, but some IDEs and IPython have
autoreload magic which can mean that NumPy gets reloaded a second
time. This is not safe, but when it happens ignoring that an
identical docstring is already attached fixes the issue.
|
|
|
|
|
|
| |
Add a deprecation warning in the `numpy.dual` module, and
remove the use of `numpy.dual` from the few places where it
is used in the numpy code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(gh-15463)
xref gh-14778
As pointed out in the comment by @jamesthomasgriffin, we did not include a pxd file to expose the distribution functions documented in the random c-api. This PR adds a c_distributions.pxd file that exposes them.
Squashed commits:
* BUG: add missing c_distributions.pxd to enable cython use of random C-API
* ENH, TST: add npyrandom library like npymath, test cython use of it
* BUG: actually prefix f-string with f
* MAINT: fixes from review, add _bit_generato_bit_generator.pxd
* STY: fixes from review
* BLD: don't use nprandom library for mtrand legacy build
* TST: WindowsPath cannot be used in subprocess's list2cmdline
* MAINT, API: move _bit_generator to bit_generator
* DOC: add release note about moving bit_generator
* DOC, MAINT: fixes from review
* MAINT: redo dtype determination from review
|
|
|
|
|
|
|
| |
* Cleanup unused imports (F401) of mostly standard Python modules,
or some internal but unlikely referenced modules
* Where internal imports are potentially used, mark with noqa
* Avoid redefinition of imports (F811)
|
|
|
|
|
| |
Modified __dir__() to remove duplicate "Tester/Testing" attribute. Also added a test to verify this.
Closes gh-15383
|
|\
| |
| | |
DEP: add PendingDeprecation to matlib.py funky namespace
|
| | |
|
|/
|
|
|
|
|
| |
This replaces basestring with str except in
- tools/npy_tempita/
- numpy/compat/py3k.py
|
| |
|
| |
|
|\
| |
| |
| | |
remove-numpy.distutils.compat
|
| |
| |
| |
| |
| |
| |
| | |
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
|
| |
| |
| |
| |
| |
| |
| | |
On Python 3, int_asbuffer throws NotImplementedError and goes unused
internally.
Fixes #12425
|
| |
| |
| |
| |
| | |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|/
|
|
| |
`get_exception` has no callers as of this commit's parent, and is hard to argue as public API given the only docstring in the file refers to "inside distutils".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* API: restructure and document numpy.random C-API
* DOC: fix bad reference
* API: ship, document, and start to test numpy.random C-API examples
* API, DOC, TST: fix tests, refactor documentation to include snippets
* BUILD: move public headers to numpy/core/include/numpy/random
* TST: ignore DeprecationWarnings in setuptools and numba
* DOC: document the C-API as used from Cython
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Docstring isn't used to render the html docs, that is controlled by
``routines.linalg.rst``. Still good to bring the contents of
function listings of the module docstring in line with that file.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Removes these files that were deprecated since 1.15.0:
- numpy/testing/decorators.py
- numpy/testing/noseclasses.py
- numpy/testing/nosetester.py
This also resolves a failure in the recently introduced tests
in `test_public_api.py` (see gh-14454). Closes gh-14566
|
|
|
|
|
| |
Also remove `numpy.ma.version.py`, it was not importable and served
no purpose.
|
| |
|
| |
|
|
|
|
| |
Also address other review comments.
|