summaryrefslogtreecommitdiff
path: root/numpy/lib/_datasource.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Various minor code cleanups.Charles Harris2017-11-241-0/+15
| | | | Minor cleanups of old code to reflect more modern usage.
* MAINT: Refactor some code in npyio.py.Charles Harris2017-11-211-1/+7
|
* DOC: Add some docstrings and edit others.Charles Harris2017-11-211-2/+42
| | | | | | | Add docstrings for some of the support functions in _datasource and npyio in order to aid future maintainers. [ci skip]
* ENH: Add encoding option to numpy text IO.Julian Taylor2017-11-211-14/+74
| | | | | | | | | | | 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.
* ENH: Spelling fixesVille Skyttä2017-05-091-1/+1
|
* DOC: Fix more typos in docs and comments.Dongjoon Hyun2016-02-251-2/+2
|
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-59/+70
| | | | The rules enforced are the same as those used for scipy.
* MAINT: Fixes for problems in numpy/lib revealed by pyflakes.Charles Harris2014-07-311-5/+4
| | | | | | Some of those problems look like potential coding errors. In those cases a Fixme comment was made and the offending code, usually an unused variable, was commented out.
* BUG: close file-like objects returned by urlopencgohlke2013-10-151-0/+2
| | | Fix `ResourceWarning: unclosed file` on Python 3
* 2to3: Apply urllib fixer.Charles Harris2013-04-141-4/+12
| | | | | | | | | | | Various functions have been moved around in the stdlib for Python 3, this fixes that up so that the code is valid in both Python 2 and Python 3. Note: monkey patching the stlib urlopen for testing looks a bit hokey to me, but I don't see an easier, more reliable way to do the test. Closes #3090.
* 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: Apply `imports` fixer.Charles Harris2013-04-021-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+1
| | | | | | | | 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.
* STY: Fix up some remaining old-style exceptions.Charles Harris2011-04-051-2/+2
| | | | I think that is the end of it.
* 3K: lib: Make _datasource and its tests Py3 compatible + slight cleanup of ↵Pauli Virtanen2010-02-201-8/+9
| | | | the code
* 3K: lib: make _datasource 2to3 friendlyPauli Virtanen2009-12-061-2/+4
|
* first set of checkins from the doc editorJarrod Millman2009-11-131-2/+1
|
* Docstring update: libPauli Virtanen2009-10-021-121/+167
|
* Import documentation from doc wiki (part 2, work-in-progress docstrings, but ↵Pauli Virtanen2008-10-281-43/+138
| | | | they are still an improvement)
* reindenting prior to releaseJarrod Millman2008-09-021-2/+2
|
* Apply modified version of Andrew Dalke's patch in #874 to create a ↵Travis Oliphant2008-08-271-13/+37
| | | | quicker-loading numpy.
* Merge from documentation editor.Stefan van der Walt2008-08-051-2/+3
|
* Defer tempfile import to improve startup time.Stefan van der Walt2008-07-311-1/+1
|
* BUG: Correctly stub out urllib2.urlopen() for tests given the refactoring of ↵Robert Kern2008-07-031-1/+1
| | | | the local imports.
* BUG: need to create exceptions correctly.Robert Kern2008-07-031-2/+2
|
* Reduce numpy's import times by delaying a few time consuming imports to the ↵Robert Kern2008-07-031-1/+6
| | | | point of actual use and global instantiations of finfo. Thanks to David Cournapeau for tracking down and fixing the import part of the problem.
* Fixing #738: Even more careful drive letter handling. And make the tests ↵Pauli Virtanen2008-04-191-1/+1
| | | | actually pass on Windows.
* Fixing #738: remember to sanitize away also Windows drive lettersPauli Virtanen2008-04-191-1/+2
|
* Fix bug #738 and add corresponding tests.Pauli Virtanen2008-04-191-1/+16
| | | | | | | | lib._datasource.DataSource.abspath now sanitizes path names more carefully, making sure that all file paths reside in destdir, also on Windows. (Where both '/' and os.sep function as path separators, as far as os.path.join is concerned.)
* Don't require gzip or bz2 until the actual functionality is requested.Robert Kern2008-04-171-4/+11
|
* Merge the lib_for_io branch back into the trunk.Travis Oliphant2007-12-301-0/+443