summaryrefslogtreecommitdiff
path: root/numpy/lib/arrayterator.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: simplify code that assumes str/unicode and int/long are different ↵Eric Wieser2020-03-261-3/+1
| | | | | types (#15816) Cleanup from the dropping of python 2
* STY: use 'yield from <expr>' for simple cases (#15444)Mike Taves2020-01-271-2/+1
| | | | | | | | | This PR uses simple cases of PEP 380 to rewrite: for v in g: yield v into: yield from <expr>
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-1/+1
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* 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.
* TST, DOC: enable refguide_checkTyler Reddy2018-12-141-4/+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
* MAINT: replace len(x.shape) with x.ndimEric Wieser2017-02-241-2/+2
|
* DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-2/+2
| | | | Closes gh-6863.
* DOC: add lib.Arrayterator to reference guide. Closes gh-6404.Ralf Gommers2015-10-111-4/+3
|
* MAINT: remove use of 'raise StopIteration' from generatorsNathaniel J. Smith2015-06-241-2/+2
| | | | | | This triggers a PendingDeprecationWarning in py3.5 -- you're supposed to just write "return" instead (which on earlier versions is equivalent). See PEP 479: https://www.python.org/dev/peps/pep-0479/
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-5/+8
| | | | 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-1/+0
| | | | | | 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.
* 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/+4
| | | | | | | | | | | | | | | | | | | 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.
* Merge pull request #3202 from charris/2to3-reduce-fixupsnjsmith2013-04-071-2/+1
|\ | | | | MAINT: Cleanup some imports involving reduce.
| * MAINT: Cleanup some imports involving reduce.Charles Harris2013-04-061-2/+1
| | | | | | | | | | | | | | | | | | | | Because reduce has been available in functools since Python 2.6 we can get rid of the version checks we currently have before we import it. Also removes some reduce related skips in tools/py3tool.py. We were already skipping the reduce fixer so this has no effect other than cleaning up the code.
* | 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-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-1/+0
| | | | | | | | 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.
* DOC: merge more doc wiki edits.rgommers2011-03-021-0/+29
|
* 3K: BUG: work around bugs in Python 3.1.1 2to3 by not using fixes_reducePauli Virtanen2010-02-201-0/+4
| | | | Instead, manually import reduce where necessary.
* Docstring update: libPauli Virtanen2009-10-021-18/+63
|
* Add Roberto de Almeida's Arrayterator.Stefan van der Walt2008-08-131-0/+146