| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
The numarray and oldnumeric modules are deprecated. This is a bit tricky
as raising a DeprecationWarning on import causes an error when tests are
run. To deal with that, a ModuleDeprecationWarning class is added to
numpy and NoseTester is modified to ignore that warning during testing.
Closes #2905
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The idioms fixer makes the following replacements.
1) int <- bool
2) comparison or identity of types <- isinstance
3) a.sort() <- sorted(a)
There were two problems that needed to be dealt with after the
application of the fixer. First, the replacement of comparison or
identity of types by isinstance was not always correct. The isinstance
function returns true for subtypes whereas many of the places where the
fixer made a substitution needed to check for exact type equality.
Second, the sorted function was applied to arrays, but because it treats
them as iterators and constructs a sorted list from the result, that is
the wrong thing to do.
Closes #3062.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 `imports` fixer deals with the standard packages that have been
renamed, removed, or methods that have moved.
cPickle -- removed, use pickle
commands -- removed, getoutput, getstatusoutput moved to subprocess
urlparse -- removed, urlparse moved to urllib.parse
cStringIO -- removed, use StringIO or io.StringIO
copy_reg -- renamed copyreg
_winreg -- renamed winreg
ConfigParser -- renamed configparser
__builtin__ -- renamed builtins
In the case of `cPickle`, it is imported as `pickle` when python < 3 and
performance may be a consideration, but otherwise plain old `pickle` is
used.
Dealing with `StringIO` is a bit tricky. There is an `io.StringIO`
function in the `io` module, available since Python 2.6, but it expects
unicode whereas `StringIO.StringIO` expects ascii. The Python 3
equivalent is then `io.BytesIO`. What I have done here is used BytesIO
for anything that is emulating a file for testing purposes. That is more
explicit than using a redefined StringIO as was done before we dropped
support for Python 2.4 and 2.5.
Closes #3180.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
2to3: Replace xrange by range and use list(range(...)) where needed
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In python3 range is an iterator and `xrange` has been removed. This has
two consequence for code:
1) Where a list is needed `list(range(...))` must be used.
2) `xrange` must be replaced by `range`
Both of these changes also work in python2 and this patch makes both.
There are three places fixed that do not need it, but I left them in
so that the result would be `xrange` clean.
Closes #3092
|
|/ |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This changes the `exec` command to the `exec` function.
|
|
|
|
|
|
|
|
|
| |
This removes files and code supporting scons builds. After this change
numpy will only support builds using distutils or bento. The removal of
scons has been discussed on the list several times and a decision has been
made that scons support is no longer needed. This was originally discussed
for numpy 1.7 and because the distutils and bento methods are still
available we are skipping the usual deprecation period.
|
|
|
|
| |
See https://github.com/scipy/scipy/pull/279
|
|
|
|
|
|
| |
Also clean up its API slightly so that the caller passes in a name
describing the array being checked which is used to generate an error
message, rather than writing an error message from scratch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes all direct assignments of non-NULL values to the
'base' field on PyArrayObjects. A new utility function was created to
set up UPDATEIFCOPY arrays, and all assignments to 'base' were
adjusted to use either PyArray_SetBaseObject or the new
PyArray_SetUpdateIfCopyBase.
One advantage of this is that it produces more consistent error
handling. This error handling revealed a bug in the nditer code,
which this patch does *not* yet fix.
The bug is that npyiter_new_temp_array sometimes (when dealing with
reversed axes) creates an array and then returns a view onto it. But,
npyiter_allocate_arrays assumes that the array returned by
npyiter_new_temp_array can have UPDATEIFCOPY set, which requires
reassigning its 'base' field. Previously, this meant that the
temporary array leaked. Now, it produces a ValueError.
This code path doesn't seem to actually be hit very often; only one of
the nditer tests fails because of the change. See
numpy/core/tests/test_nditer.py:test_iter_array_cast_buggy
|
|
|
|
|
|
|
|
|
| |
This is mostly a code cleanup, but it does have a user-visible effect
in that attempting to write to a unwriteable array now consistently
raises ValueError. (It used to randomly raise either ValueError or
RuntimeError.)
Passes numpy.test("full").
|
|
|
|
| |
versioned
|
|
|
|
|
| |
With the exception of the numarray fixups these were all instances
that were results of code generation.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Thanks to Christoph Gohlke.
|
|
|
|
| |
on Python 2.x
|
| |
|
|
|
|
|
|
|
| |
compatibility functions in npy_3kcompat.h to replace the current calls.
This gets rid of a number of version checks and is easier to maintain.
Fix bug that was present in the ufunc _loop1d_list_free destructor in
the python3k case.
|
|
|
|
| |
them to comments
|
|
|
|
| |
in a position to do.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
2to3, but that may have been an artifact from a previous build. In anycase, no
harm done.
|
| |
|
| |
|
|
|
|
| |
directory does not confuse 2to3's relative import conversion
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Removed repeated members of __all__.
Fixed reference to undefined "out" in functions.py:take function.
Fixed references to undefined "N" in functions.py.
Rewrapped lines to conform to PEP8.
Fixed references to undefined FPE_* constants (from numpy) in util.py.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Added numpy.testing.run_module_suite to simplify "if __name__ == '__main__'" boilerplate code in test
modules.
Removed numpy/testing/pkgtester.py since it just consisted of an import statement after porting SciPy r4424.
Allow numpy.*.test() to accept the old keyword arguments (but issue a deprecation warning when old arguments
are seen).
numpy.*.test() returns a test result object as before.
Fixed typo in distutils doc.
|