| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
This affected (for example?) if the `dtype=object` was used
without a converter, meaning that the default one is used.
And this is currently the last one, which is `string_` (and thus
bytes).
Closes gh-16189
|
|
|
|
|
| |
types (#15816)
Cleanup from the dropping of python 2
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* BUG: Fix leaking of object descriptor on dtype discovery of `None`
* BUG: Fix reference count leak in string discovery code path
* BUG: Fix two more datetime related reference count bugs
One is leaking only the python integer 1, the other a descriptor.
* BUG: Fix bugs in vectorized string functions error paths
Fixes reference count issues (a leak) in
TestVecString::test_non_existent_method and
TestVecString::test_non_string_array
* BUG: Fix Reference count leak in in128 C-level tests
* BUG: Fix refcount leak in advanced indexing error path
* BUG,MAINT: Refactor indexing dtypes handling in mapiter constructor
Using borrowed references for the dtypes seems much easier to get
the reference counts right.
* BUG: Reference leaks in deprecated datetime with timezone coercion
* BUG: Refcount issue in nonzero 0-d path
* BUG: Fix ufunc.at dtype refcount handling in resolver
* BUG: Fix reference count in nditer python op_axes setup
* BUG: Reference leak in writebackifcopy non-array error path
* BUG: Add missing DECREF in ufunc with dtype type resolution
* BUG: Reference count bugs in io functions
* BUG: Reference count loss in as_c_array C-side tests
* BUG: Leaking of method in object method based ufunc loops
The function could possibly be optimized nicely by checking
that the method will be the same because the types are identical.
OTOH, that may not be correct in dynamically adapted types.
* TST: Clean up cyclic ctypes reference to simplify leak debugging
If we do not clean it up in this test, the collection can take
so long that it affects the following tests when running with
reference leak debugging tools (pytest-leaks).
* BUG: Reference count of raw data for 0-sized unpickling
* TST: Mark tests which must leak references
It really may be time to remove this, considering how annoying this
is, may want to think about getting rid of that behaviour.
Could probably write a multiearraytests C-side function instead.
* BUG: Fix refcount leaks in arr.getield and setfield error paths
* BUG: Fix refcount issue in wheremask
This fix is not the prettiest, since it relies on the wheremask
to be formatted to boolean beforehand correctly.
* TST: Reset StringConvert after mutating it in tests
Or maybe just mark the test?
* BUG: Fix missing static for npy_cache_import in umath funcs.inc.src
* BUG: Fix refcount in multiternew error path
* BUG: Fix npy_ObjectGCD and LCM reference counting
* BUG: Decrement already wrapped outputs on failure
This is not super pretty, but not sure how to do it much better
right now.
* FIXUP: iotools StringConverter._mapper
* FIXUP: as_c_array tests
* FIXUP: String/dtype discovery comment
* FIXUP: Nonzero comment
* FIXUP: mapiternew -- check error return of dtype creation
In principle, at least at this time, this is not possible
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#12448)
* Review F401,F841,F842 flake8 errors (unused variables, imports)
* Review comments
* More tests in test_installed_npymath_ini
* Review comments
|
| |
|
|
|
|
| |
Fixes #11028
|
|
|
|
|
| |
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
|
|
|
|
| |
Minor cleanups of old code to reflect more modern usage.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This modifies loadtxt and genfromtxt in several ways intended to add
unicode support for text files by adding an `encoding` keyword to
np.load, np.genfromtxt, np.savetxt, and np.fromregex. The original
treatment of the relevant files was to open them as byte
files, whereas they are now opened as text files with an encoding. When
read, they are decoded to unicode strings for Python3 compatibility,
and when written, they are encoded as specified. For backward
compatibility, the default encoding in both cases is latin1.
|
|
|
|
|
|
|
| |
This is the case for x in {int, bool, str, float, complex, object}.
Using the np.{x} version is deceptive as it suggests that there is a
difference. This change doesn't affect any external behaviour. The
`long` type is missing in python 3, so np.long is still useful
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Fix StringConverter to avoid OverflowError in genfromtxt. Before, int(2**66) would work
(and return a ‘long’) but then np.array([2**66], dtype=np.integer) would not work and
return an OverflowError which would propagate to genfromtxt. This commit fixes this by
ensuring testing in advance whether an OverflowError will occur. In addition, this adds
an explicit np.int64 entry on systems where integer means int32. Values larger than
2**63-1 will be cast as float. This includes a regression test and adds an entry to the
release notes.
|
|
|
|
|
|
|
| |
The function was useing `'u' in case_sensitive` to detect `upper`.
Make that more precise with `case_sensitive.startswith('u').
Raise ValueError if case_sensitive has unrecognized value.
|
|
|
|
| |
numpy.lib._iotools.StringConverter.upgrade should have a return value
|
|
|
|
|
|
|
| |
The possibly controversial part of this is making the nested array
value lists PEP8 compliant, as there is something to be said aligning
the values for clarity. In the end, it seemed like the easiest thing
to do was to make them PEP8 compliant. The eye can get used to that.
|
| |
|
|
|
|
|
|
|
| |
Run autopep8 over the test files in numpy/lib/test and make fixes
to the result.
Also remove Python5 workaround.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
assert in non-testing files that should be checked for correctness.
|
|
|
|
| |
genfromtxt.
|
|
|
|
|
|
| |
Stefan vdW for the fix.
* added a unittest for flatten_dtype
|
| |
|
|
|
|
| |
genfromtxt
|
|
|
|
|
| |
Trailing whitespace removal.
Some coding style cleanups.
|
|
|
|
|
|
|
|
|
|
| |
- prevents a `default` of 0 to be overwritten during initialization
- allows the `missing_values` to be a comma-separated string
* io.genfromtxt
- `usecols` can now be a single integer
- for `usecols` and `names` to list (for compatibility w/ Python 2.5)
- negative values in `usecols` are properly transformed to positive integers
- fixed `usecols` with named columns
|
|
|
|
|
|
|
|
|
|
| |
- prevents an explicit default to be overwritten during upgrade
* io.genfromtxt
- deprecate `skiprows` for `skip_header`
- deprecate `missing` for `missing_values`
- `missing_values` can now be a sequence
- add support for `filling_values`
* fixed ticket #1257
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
#1253)
* lib._iotools:
- NameValidator : add the `nbfields` optional argument to validate
- add easy_dtype
* lib.io.genfromtxt :
- add the `autostrip` optional argument (ticket #1238)
- use `invalid_raise=True` as default
- use the easy_dtype mechanism (ticket #1252)
|
| |
|
|
|
|
|
|
| |
Raise a NotImplementedError if the dtype is nested.
* _iotools : make sure StringConverter gets properly initiated when a function returning a np.object is used as input parameter.
|
| |
|
|
|
|
| |
* MaskedArray.__rmul__ : switch to multiply(self, other)
|
|
* lib.io : introduced genfromtxt, ndfromtxt, mafromtxt, recfromtxt, recfromcsv.
|