summaryrefslogtreecommitdiff
path: root/numpy/lib/format.py
Commit message (Collapse)AuthorAgeFilesLines
* TST: make xfailed test for modules in public API pass.Ralf Gommers2019-09-191-0/+3
|
* DOC: add space between words across linesmattip2019-07-101-1/+1
|
* Merge branch 'master' into force-zip64Charles Harris2019-06-261-8/+2
|\
| * MAINT: Use a with statement instead of try / finallyEric Wieser2019-06-041-8/+2
| | | | | | | | All of this code was already correct, this just tidies it a little
* | ENH: always use zip64, upgrade pickle protocol to 3mattip2019-05-231-3/+2
|/
* Merge branch 'master' into npy-2.1Matti Picus2019-05-191-4/+8
|\
| * MAINT: remove uneeded codemattip2019-05-111-6/+4
| |
| * BUG: parse more subarrays in descr_to_dtypemattip2019-05-031-2/+7
| |
| * BUG: handle subarrays in descr_to_dtypemattip2019-04-301-3/+4
| |
* | BUG/ENH: Create npy format 3.0Eric Wieser2019-05-071-15/+36
| | | | | | | | | | | | | | | | This version encodes the dtype as utf8 instead of latin1. Unfortunately we need to create a new version to make this change, because we did not limit ourselves to ASCII in versions 1 and 2. Fixes gh-7391
* | MAINT: Simplify computation of npy format headersEric Wieser2019-05-071-49/+52
|/ | | | This works towards adding a third format that supports utf8
* BUG: load fails when using pickle without allow_pickle=TruePaul Ivanov2019-04-161-3/+7
| | | | | | a partial mitigation of #12759. see also https://nvd.nist.gov/vuln/detail/CVE-2019-6446
* BUG: Fix errors in string formatting while producing an errorEric Wieser2019-03-021-13/+13
| | | | | | | | | | `"Invalid version %r" % (1, 2)` would fail with `TypeError: not all arguments converted during string formatting` The `Header is not a dictionary` error had a similar problem. Fixed by changing this entire function to use `.format` in place of `%`, which does not have this gotcha. Found using LGTM.com
* MAINT: Move pickle import to numpy.compatCharles Harris2019-02-211-2/+1
| | | | | | | The pickle module was being imported from numpy.core.numeric. It was defined there in order to use pickle5 when available in Python3 and cpickle in Python2. The numpy.compat module seems a better place for that.
* MAINT: fix from reviewmattip2018-11-141-6/+2
|
* BUG: fix for titles, cleanup, fixes from reviewmattip2018-11-131-7/+20
|
* BUG: test, fix loading structured dtypes with paddingmattip2018-11-131-1/+29
|
* ENH: Improve support for pathlib.Path objects in load functions (#11348)Paul Müller2018-11-011-7/+9
| | | * ENH: Improve support for pathlib.Path objects in more functions
* MAINT, TST import pickle from numpy.core.numericPierre Glaser2018-10-101-4/+1
| | | | | | | | All imports of pickle from numpy modules are now done this way: >>> from numpy.core.numeric import pickle Also, some loops on protocol numbers are added over pickle tests that were not caught from #12090
* HTTP -> HTTPS, and other linkrot fixesMike Toews2018-06-161-1/+1
|
* DOC: add numpy.lib.format to docs and link to itmattip2018-05-141-4/+3
|
* DOC: create label and ref, fixes broken linkmattip2018-05-131-0/+3
|
* DOC: link to updated module docstring, not NEPmattip2018-05-131-3/+8
|
* minor fix for python3 compatibilityDennis Weyland2018-02-051-2/+2
|
* python 2.7.5 bugfixDennis Weyland2018-02-051-2/+5
|
* ENH: Align data in np.save() at 64 bytes (#9025)John Zwinck2017-09-131-22/+29
| | | | | | | | | | | | | Previously, saving format version 1 would align to 16 bytes, and saving version 2 would align improperly (bug #8085). Alignment is now always at least 64 bytes in either version, which supports memory mapping of the saved files on Linux, where mmap() offset must be a multiple of the page size. Why 64 bytes? Simply because we don't know of a case where more is needed. AVX alignment is 32 bytes; AVX-512 is 64. Fixes #8085, closes #8598.
* MAINT: Remove asbytes where a b prefix would sufficeEric Wieser2017-03-251-1/+1
| | | | | | | | 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.
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-2/+2
|
* BUG: Fixes to reading and writing of empty arrays, and in particular arrays ↵Erik M. Bray2016-05-311-11/+20
| | | | with empty dtypes. See #6430
* BUG: Cast size to int64 when loading from archivedrasmuss2016-05-091-1/+1
| | | | | Prevents overflow errors for large arrays on systems where the default int type is int32.
* MAINT: Dictionary litteralRémy Léone2015-11-071-2/+1
|
* ENH: add options for disabling use of pickle in load/savePauli Virtanen2015-04-181-4/+16
|
* BUG: don't ignore version passed to format.write_arrayBlake Griffith2015-04-051-11/+9
| | | | Previously the passed in version was ignored
* BUG: Make read_array_header_* return resultsBlake Griffith2015-04-011-2/+2
| | | | | | | Previously read_array_header_1_0 & read_array_header_2_0 were not returning the documented results. Closes #5602
* STY: fold long linesPauli Virtanen2015-03-081-2/+4
|
* BUG: enable working around pickle compatibility issues on Py3 in npy filesPauli Virtanen2015-03-081-4/+22
| | | | | | Add pickle compatibility flags to numpy.save and numpy.load. Allow only combinations that cannot corrupt binary data in Numpy arrays. Use the same default values as Python pickle.
* DOC: update npy-format NEP and lib/format.py with version 2.0 description.Ralf Gommers2015-01-041-0/+13
| | | | As discussed on gh-5413. Version 2.0 was added in gh-4765.
* Change pronoun in doc string from "his" to gender-neutral "their"Bob Poekert2014-12-051-1/+1
|
* BUG: Fix writing of intrinsic long integers in python2 npy files.Charles Harris2014-10-131-3/+4
| | | | | | | | | | This only happens when C long is smaller than npy_intp, in particular, on 64 bit windows. The 'L' suffix is not needed as long as safe_eval is used to recover the values, and the long intrinsic causes problems for python3. The python3 read side has been fixed, but we might as well fix the problem at the root as well.
* BUG: Make python2 *.npy files readable in python3.Charles Harris2014-10-121-1/+41
| | | | | | | | | | The Python2 generated file had long integer literals like '1L' that broke in Python3. The fix here is to filter out the 'L' and let safe_eval take care of the integer type in converting the string. The fix here comes from Nathaniel Smith with a few added fixups. Closes #5170.
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-51/+51
| | | | The rules enforced are the same as those used for scipy.
* ENH: add storage format 2.0 with 4 byte header length sizeJulian Taylor2014-06-021-32/+139
| | | | | | | | | | | | | The new format only increases the header length field to 4 bytes. allows storing structured arrays with a large number of named columns. The dtype serialization for these can exceed the 2 byte header length field required by the 1.0 format. The generic functions automatically use the 2.0 format if the to be stored data requires it. To avoid unintentional incompatibilies a UserWarning is emitted when this happens. If the format is not required the more compatible 1.0 format is used. Closes gh-4690
* ENH: add tobytes and stop using tostring in documentationJulian Taylor2014-02-111-2/+2
| | | | | | | tostring returns bytes which are not equal to string, so provide a tobytes function alias. tostring does not emit a deprecation warning yet so rdepends do not need to check two names to support older versions of numpy without warnings.
* MAINT: Introduced _read_array functionMax Sperlich2013-12-111-25/+37
| | | | | | | | | This wrapper function is used everywhere in format.py now to ensure to correctly the handle the case when fp.read returns fewer bytes than requested. Also added a test for the orignal bug, loading an array of size more than 64K from a zip file.
* MAINT: Better handling of very small chunksMax Sperlich2013-12-091-4/+5
| | | | | | Issue 4093: Improved the handling of the case when the amount of data read by fp.read is smaller than dtype.itemsize. Also changed the test code to make sure this case is tested.
* TST: Adds test case for Issue 4093Max Sperlich2013-12-081-0/+4
|
* BUG: Fixes Python3 compatibilityMax Sperlich2013-12-081-1/+1
|
* BUG: fix loading from compressed .npz (Issue 4093)Max Sperlich2013-12-081-6/+9
| | | | | | In Python 2.6.x the number of bytes read from a zip file is 2^16, which is less than the 2^18 requested by lib.format.py. This change handles the case where fp.read() returns fewer than the requested number of bytes.
* ENH: Use nditer in numpy.save to stream bytes to custom file objectsOlivier Grisel2013-11-261-4/+13
|
* When reading file in chunks, buffer_size < dtype.itemsize, ensure at least ↵Luke Carmichael2013-11-081-1/+1
| | | | one read