summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #22619 from seberg/move-set_moduleMatti Picus2022-11-291-1/+1
|\ | | | | MAINT: Move set_module from numpy.core to numpy._utils
| * MAINT: Move set_module to numpy.core to use without C importSebastian Berg2022-11-241-1/+1
| |
* | DOC: Update mode parameter description to account for shape #22643 (#22655)mkiffer2022-11-231-1/+2
|/ | | | | | 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>
* MAINT: use super() as described by PEP 3135Mike Taves2021-03-191-2/+2
|
* MAINT: Replace `contextlib_nullcontext` with `contextlib.nullcontext`Bas van Beek2020-12-051-6/+6
|
* Update numpy/core/memmap.pyMatti Picus2020-11-111-1/+1
| | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* DOC: update documentation of numpy.memmapMatti Picus2020-11-111-4/+7
|
* MAINT: Chain exceptions in memmap.py and core.py (#16067)Chris Holland2020-05-011-3/+5
| | | | | * Improve chained exception reporting Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* MAINT: simplify code that assumes str/unicode and int/long are different ↵Eric Wieser2020-03-261-2/+2
| | | | | types (#15816) Cleanup from the dropping of python 2
* MAINT: Replace basestring with str.Charles Harris2020-01-231-2/+2
| | | | | | | This replaces basestring with str except in - tools/npy_tempita/ - numpy/compat/py3k.py
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* BUG: Fix bad error message in np.memmapEric Wieser2019-04-111-1/+1
| | | | | | | | | | | | 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
* TST, DOC: enable refguide_checkTyler Reddy2018-12-141-3/+3
| | | | | | | | * 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
* ENH: set correct __module__ for objects in numpy's public APIStephan Hoyer2018-11-131-0/+3
| | | | | | | | | | | | | 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 :).
* ENH: Add support for third-party path-like objects by backporting os.fspathEric Wieser2018-10-121-11/+8
|
* MAINT: Use a conditional expression instead of boolean operatorsEric Wieser2018-09-231-2/+2
|
* MAINT: Close the file if any unexpected errors occur within memmapEric Wieser2018-09-231-67/+63
|
* STY: remove C-like parenthesesEric Wieser2018-09-231-1/+1
|
* BUG: Don't leave the file open if a bad shape argument is passed to memmapEric Wieser2018-09-231-3/+3
|
* Restore a line that I accidentally deleted rather than reverted in earlier diffPat Gunn2018-06-111-0/+1
|
* reviewPat Gunn2018-06-031-1/+1
|
* Revise further as per peer reviewPat Gunn2018-06-031-2/+1
|
* Revise further as per peer reviewPat Gunn2018-06-031-2/+1
|
* Responding to peer review, change to intpPat Gunn2018-06-031-2/+2
|
* In numpy.memmap forcibly promote shape to uint64Pat Gunn2018-06-011-1/+2
|
* DOC: Improve docstring of memmaplumbric2018-03-051-1/+1
| | | See also 8a38f64.
* 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.
* FIX set memmap offset attribute correctlyLoïc Estève2017-01-051-2/+2
| | | | when offset is greater than mmap.ALLOCATIONGRANULARITY
* Merge pull request #7987 from f0k/advertise-open_memmapCharles Harris2016-10-281-0/+4
|\ | | | | DOC: See also np.load and np.memmap in np.lib.format.open_memmap
| * DOC: Hint at lib.format.open_memmap from np.load and np.memmapJan Schlüter2016-08-291-0/+4
| | | | | | | | | | | | | | 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.
* | DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-1/+1
|/ | | | The strings in error messages were left untouched
* DOC: #7927. Remove deprecated note for memmap relevant for Python <2.5 [ci skip]Tom Bird2016-08-171-0/+2
|
* DOC: #7927. Remove deprecated note for memmap relevant for Python <2.5Tom Bird2016-08-171-5/+0
|
* ENH: Add support for pathlib.Path objects to save/load functionsWendell Smith2016-04-061-3/+8
|
* FIX ufunc called on memmap return a ndarrayLoïc Estève2016-04-041-0/+21
| | | | | | | 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.
* MAINT: Fix some pyflakes warnings in numpy/core/*.pyCharles Harris2015-07-051-5/+2
| | | | | | | | | 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.
* STY: PEP8 fixes for numpy/core/*.pyCharles Harris2015-07-051-0/+1
|
* DOC: Update docs.Gabor Kovacs2015-06-211-4/+4
| | | | | | | Update docs for boolean array indexing and nonzero order. Add links to row-major and column-major terms where they appear. Closes #3177
* DOC: core: contents of newly allocated space in memmapLars Buitinck2014-10-121-0/+5
| | | | Fixes #5157.
* DOC: Remove close method from memmap docstring.Charles Harris2014-02-181-2/+3
| | | | Memmap objects no longer have a close method.
* Update memmap.pyAndreas Hilboll2013-10-101-1/+3
| | | Clarify `memmap` docstring to better reflect the meaning of *offset*.
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-2/+2
| | | | | | | 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.
* BUG: set filename to None for memmaps of unnamed filesJulian Taylor2013-05-251-1/+6
| | | | Closes gh-3302
* MAINT: Remove unneeded version checks.Charles Harris2013-04-241-8/+4
| | | | | | 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.
* 2to3: Apply basestring fixer.Charles Harris2013-04-131-1/+1
| | | | | | | | | | | 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.
* 2to3: Apply the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-131-1/+2
| | | | | | | | | | | | | | | | | | | 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.
* 2to3: apply `dict` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | | | | | | | | | 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.
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Use absolute imports.Charles Harris2013-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+2
| | | | | | | | 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.