summaryrefslogtreecommitdiff
path: root/numpy/numarray/functions.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-021-1/+1
| | | | | | | | | | | | | | | | | | | The idioms fixer makes the following replacements. 1) int <- bool 2) comparison or identity of types <- isinstance 3) a.sort() <- sorted(a) There were two problems that needed to be dealt with after the application of the fixer. First, the replacement of comparison or identity of types by isinstance was not always correct. The isinstance function returns true for subtypes whereas many of the places where the fixer made a substitution needed to check for exact type equality. Second, the sorted function was applied to arrays, but because it treats them as iterators and constructs a sorted list from the result, that is the wrong thing to do. Closes #3062.
* 2to3: Apply the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-131-2/+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 `print` fixer.Charles Harris2013-04-061-19/+19
| | | | | | | 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-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-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
* Merge pull request #3122 from charris/2to3-apply-xrange-fixerCharles Harris2013-03-281-3/+3
|\ | | | | 2to3: Replace xrange by range and use list(range(...)) where needed
| * 2to3: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In python3 range is an iterator and `xrange` has been removed. This has two consequence for code: 1) Where a list is needed `list(range(...))` must be used. 2) `xrange` must be replaced by `range` Both of these changes also work in python2 and this patch makes both. There are three places fixed that do not need it, but I left them in so that the result would be `xrange` clean. Closes #3092
* | fix undefined function and add integer divisionsJulian Taylor2013-03-261-5/+18
|/
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-14/+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.
* 3K: ENH: make numpy.numarray to importPauli Virtanen2010-02-211-0/+3
|
* Removed unused/duplicate imports.Alan McIntyre2008-09-131-9/+9
| | | | | | | | Removed repeated members of __all__. Fixed reference to undefined "out" in functions.py:take function. Fixed references to undefined "N" in functions.py. Rewrapped lines to conform to PEP8. Fixed references to undefined FPE_* constants (from numpy) in util.py.
* typoJarrod Millman2007-12-291-1/+1
|
* typoJarrod Millman2007-12-291-1/+1
|
* janitorial workJarrod Millman2007-12-291-50/+55
|
* Small fix for numpy.info(), which was unconditionally brokenFernando Perez2007-06-201-1/+1
|
* Fix numarray.fromstringTravis Oliphant2007-02-281-2/+2
|
* Whitespace cleanup.Stefan van der Walt2007-01-081-13/+12
|
* Fix the fromfunction routine to use float as default. Update oldnumeric and ↵Travis Oliphant2006-09-281-3/+6
| | | | numarray compatibility modules.
* Fix ticket #188 by returning the name of the dtype objects for data-type ↵Travis Oliphant2006-09-161-17/+47
| | | | objects without fields or sub-arrays that are in correct byte-order
* Fix numarray.info functionTravis Oliphant2006-09-151-4/+4
|
* Clean-up some un-needed default axes. Fix default axes of ma.sum and ma.productTravis Oliphant2006-08-291-2/+2
|
* Add axis arguments to various functions so as not to rely on the defaults.Travis Oliphant2006-08-291-2/+2
|
* Change default axis argument of average and several masked array functions. ↵Travis Oliphant2006-08-131-1/+4
| | | | Move old behaviors to compatibility layer.
* Finished up numpy.numarray.alter_code1Travis Oliphant2006-08-101-1/+10
|
* Add output arguments to a few more functions for consistencyTravis Oliphant2006-08-101-1/+7
|
* Update C-API to add features needed for numarray compatibility. Output ↵Travis Oliphant2006-08-101-55/+408
| | | | argument added for several functions and clipmode argument added for a few others.
* Fix numarray compatibility layer so it at least imports. It's not finished ↵Travis Oliphant2006-08-081-1/+2
| | | | yet, but some functionality is there.
* Fix import problemTravis Oliphant2006-08-081-1/+1
|
* Add numarray compatibility.Travis Oliphant2006-08-081-0/+86