| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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
|
| |
|
|\
| |
| | |
TST/BUG: fromfile - fix test and expose bug with io class argument
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This bug only manifests itself in the Python 2 code path.
Falls back to the current Python 3 code path also on Python 2 because
the Python 3 code path is written precisely to handle this situation.
Also fix tests, and clarify in the documentation that the current
implementation requires the stream to be seekable.
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
The original dtype converters for bytes and str
did not account for converting objects of str or
bytes dtype respectively. Replace the original
converters with those from numpy.compat, which
are much more robust.
Closes gh-8033.
|
|
|
|
|
|
|
|
| |
In some places, just remove aparently unnecessary filters.
After this, all cases of ignore filters should be removed from
the tests, making testing (even multiple runs) normally fully
predictable.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pathlib was only added to the stdlib in Python 3.4, and there it
can handle string type input for a file with UTF8 encoding.
But the Patlib version on PyPi that can be installed for Python 2.7
doesn't accept strings, gives errors like:
======================================================================
ERROR: test_ndfromtxt (test_io.TestPathUsage)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rgommers/Code/numpy/numpy/testing/decorators.py", line 147, in skipper_func
return f(*args, **kwargs)
File "/home/rgommers/Code/numpy/numpy/lib/tests/test_io.py", line 1888, in test_ndfromtxt
f.write('1 2\n3 4')
TypeError: must be unicode, not str
|
| |
|
| |
|
|
|
|
|
| |
Without the suffix, np.save creates a new file and the file
does not get cleaned up.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces code of the pattern
```
fd, name = tempfile.mkstemp(...)
os.close(fd)
try:
do stuff with name
finally:
os.remove(name)
```
with
```
with temppath() as name:
do stuff with name
```
A few more complicated cases are also handled. The remains some
particularly gnarly code the could probably be refactored to use
temppath, but that is a more demanding project.
|
|
|
|
|
| |
The test is in numpy/lib/tests/test_io.py. This commit is intended
as a demonstration of using temppath.
|
| |
|
|
|
|
|
|
| |
Use a different strategy to detect whether np.load creates cycles.
Fixes gh-6571, I hope.
|
| |
|
|
|
|
|
|
|
|
|
| |
Those test functions were incorrectly importing test functions
from numpy/ma/testutils that were actually not defined there, but
rather in numpy/testing. That did not cause an error when testutils
was '*' importing all the test functions, but it was deceptive as
some of the functions might appear to support masked arrays when
they do not.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that the Python complex type constructor only accepts a
pair of numbers or a string, unlike other numeric types it does not work
with byte strings. The numpy error is subtle, as loadtxt opens the file
in the default text mode, but then converts the input lines to byte
strings when they are split into separate values. The fix here is to
convert the values back to strings in the complex converter.
Closes #5655.
|
|
|
|
|
|
|
|
|
| |
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 strings must be produced by the python float.hex method.
|
|\
| |
| | |
BUG: Fix genfromtext NameValidator arguments passed to easy_dtype.
|
| |
| |
| |
| |
| |
| |
| | |
The case_sensitive argument to np.recfromcsv has a default value of
'lower'. That value was not previously correctly passed on, but is
now, so the previous expected values in this test were incorrectly
upper cased.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
np.genfromtxt validates field names twice: once in genfromtxt and once
in easy_dtype. Whilst the arguments to genfromtxt are used in the first
validation, they aren't passed to easy_dtype (which is used only when
dtype != None) and therefore in this case the default validation (strip
non-alphanum, replace spaces) gets confusingly applied, ignoring
genfromtxt's arguments.
This patch adds fixes genfromtxt by passing the appropriate arguments
onwards to easy_dtype. That is probably the least invasive way to fix
the issue.
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
This allows one to specify the maximum number of row processed in
in a call. The new functionality allows for reading more complex
data formats. For instance, multiple calls can be used to read in
multiple arrays stored in a single file.
Closes #5084.
Closes #5093.
|
| |
|
| |
|
|\
| |
| |
| | |
BUG: fix genfromtxt check of converters when using usecols
|
| |
| |
| |
| |
| |
| | |
fixes an issue reported by Adrian Altenhoff where user-supplied
converters in genfromtxt were not tested with the right first_values
when also specifying usecols.
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
The version check was not valid for python3, though the whole logic can
be removed with a finally clause.
This requires that the savez tests need to cleanup the NpyzFile results
which still hold an open file descriptor.
|
|
|
|
| |
Resolves #2591. Adds more explicit error handling in line parsing loop.
|
| |
|
|\
| |
| | |
TST: clean up tempfile in test_closing_zipfile_after_load
|
| | |
|
|/ |
|
|
|
|
|
| |
mktemp only returns a filename, a malicous user could replace it before
it gets used.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Run autopep8 over the test files in numpy/lib/test and make fixes
to the result.
Also remove Python5 workaround.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
WarningManager was a workaround for the lack of the with statement
in Python versions < 2.6. As those versions are no longer supported
it can be removed.
Deprecation notes are added to WarningManager and WarningMessage, but
to avoid a cascade of messages in third party apps, no warnings are
raised at this time, that can be done later.
Closes #3519.
|
|
|
|
|
|
|
| |
This assures that when the loaded file is closed it also closes the
file descriptor, avoiding a resource warning in Python3.
Closes #3457.
|