| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
MAINT: Move set_module from numpy.core to numpy._utils
|
| | |
|
|/
|
|
|
|
| |
The `shape` parameter must be specified when opened in appending mode. Docstring
and exception message wording are updated to reflect this.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
| |
|
|
|
| |
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
|
| |
|
|
|
|
|
| |
* Improve chained exception reporting
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
|
|
|
|
|
| |
types (#15816)
Cleanup from the dropping of python 2
|
|
|
|
|
|
|
| |
This replaces basestring with str except in
- tools/npy_tempita/
- numpy/compat/py3k.py
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This previously raisd `OSError: [Errno 22] Invalid argument` while trying to seek to byte -1 of the file.
It now raises `ValueError: cannot mmap an empty file`
The simple fix is not to write the file at all if we know it's already long enough.
In future we could consider allowing memmap to do an extra write behind the scenes to ensure the fiel is not empty, but that seems out of scope.
Fixes gh-12653
|
|
|
|
|
|
|
|
| |
* ported the refguide_check module from SciPy for usage
in NumPy docstring execution/ verification; added the
refguide_check run to Azure Mac OS CI
* adjusted NumPy docstrings such that refguide_check passes
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes GH-12271
Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to
``'numpy'``, or appears in an explicit whitelist of undocumented functions and
exported bulitins. These should eventually be documented or removed.
I also identified a handful of functions for which I had accidentally not setup
dispatch for with ``__array_function__`` before, because they were listed under
"ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in
trusting code comments :).
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
See also 8a38f64.
|
|
|
|
|
|
|
|
| |
Since we only need to support python 2, we can remove any case where we just
pass a single string literal and use the b prefix instead.
What we can't do is transform asbytes("tests %d" % num), because %-formatting
fails on bytes in python 3.x < 3.5.
|
|
|
|
| |
when offset is greater than mmap.ALLOCATIONGRANULARITY
|
|\
| |
| | |
DOC: See also np.load and np.memmap in np.lib.format.open_memmap
|
| |
| |
| |
| |
| |
| |
| | |
np.load supports memmap_mode to open existing .npy files as
memory-mapped files. np.memmap supports creating or loading raw
binary files as memory-mapped files. This adds a link to a
function for creating memory-mapped files in .npy format.
|
|/
|
|
| |
The strings in error messages were left untouched
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Special case for reduction functions (e.g. np.sum with axis=None) that
return a numpy scalar.
Keep original memmap subclasses behavior to be on the safe side.
|
|
|
|
|
|
|
|
|
| |
These fixes are not agressive as some of the code is complicated
and it is better to be careful.
The files numeric.py and numerictypes.py are not easily analysed
and the latter is self modifying. Pyflakes generates a number of
invalid warnings for those files.
|
| |
|
|
|
|
|
|
|
| |
Update docs for boolean array indexing and nonzero order.
Add links to row-major and column-major terms where they appear.
Closes #3177
|
|
|
|
| |
Fixes #5157.
|
|
|
|
| |
Memmap objects no longer have a close method.
|
|
|
| |
Clarify `memmap` docstring to better reflect the meaning of *offset*.
|
|
|
|
|
|
|
| |
Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long
and will need to be broken at some point. OTOH, some lines were already
too long and need to be broken at some point. Now seems as good a time
as any to do this with open PRs at a minimum.
|
|
|
|
| |
Closes gh-3302
|
|
|
|
|
|
| |
Now that only Python versions 2.6-2.7 and 3.2-3.3 are supported
some version checks are no longer needed. This patch removes them
so as to clean up the code.
|
|
|
|
|
|
|
|
|
|
|
| |
The basestring class is not defined in Python 3 and the fixer replaces
it with str. In order to have a common code base we define basestring in
numpy/compat/py3k.py to be str when the Python version is >= 3,
otherwise basestring and import it where needed. That works for most
cases, but there are a few files where the version dependent define
needs to be in the file.
Closes #3042.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The numliterals fixer replaces the old style octal number like '01' by
'0o1' removes the 'L' suffix.
Octal values were previously mistakenly specified in some dates, those
uses have been corrected by removing the leading zeros.
Simply Removing the 'L' suffix should not be a problem, but in some
testing code it looks neccesary, so in those places the Python long
constructor is used instead.
The 'long' type is no longer defined in Python 3. Because we need to
have it defined for Python 2 it is added to numpy/compat/np3k.py where
it is defined as 'int' for Python 3 and 'long' for Python 2. The `long`
fixer then needs to be skipped so that it doesn't undo the good work.
Closes #3074, #3067.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Python3 `dict.items()`, `dict.keys()`, and `dict.values()` are
iterators. This causes problems when a list is needed so the 2to3 fixer
explicitly constructs a list when is finds on of those functions.
However, that is usually not necessary, so a lot of the work here has
been cleaning up those places where the fix is not needed. The big
exception to that is the `numpy/f2py/crackfortran.py` file. The code
there makes extensive use of loops that modify the contents of the
dictionary being looped through, which raises an error. That together
with the obscurity of the code in that file made it safest to let the
`dict` fixer do its worst.
Closes #3050.
|
|
|
|
|
|
|
| |
Add `print_function` to all `from __future__ import ...` statements
and use the python3 print function syntax everywhere.
Closes #3078.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new import `absolute_import` is added the `from __future__ import`
statement and The 2to3 `import` fixer is run to make the imports
compatible. There are several things that need to be dealt with to make
this work.
1) Files meant to be run as scripts run in a different environment than
files imported as part of a package, and so changes to those files need
to be skipped. The affected script files are:
* all setup.py files
* numpy/core/code_generators/generate_umath.py
* numpy/core/code_generators/generate_numpy_api.py
* numpy/core/code_generators/generate_ufunc_api.py
2) Some imported modules are not available as they are created during
the build process and consequently 2to3 is unable to handle them
correctly. Files that import those modules need a bit of extra work.
The affected files are:
* core/__init__.py,
* core/numeric.py,
* core/_internal.py,
* core/arrayprint.py,
* core/fromnumeric.py,
* numpy/__init__.py,
* lib/npyio.py,
* lib/function_base.py,
* fft/fftpack.py,
* random/__init__.py
Closes #3172
|
|
|
|
|
|
|
|
| |
This should be harmless, as we already are division clean. However,
placement of this import takes some care. In the future a script
can be used to append new features without worry, at least until
such time as it exceeds a single line. Having that ability will
make it easier to deal with absolute imports and printing updates.
|