summaryrefslogtreecommitdiff
path: root/numpy/compat/_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Move _inspect and _pep440 from compat to _utilsSebastian Berg2022-11-251-191/+0
| | | | | Note that unfortunately, compat does expose _inspect as well, so the import remains (just the definition place moves).
* 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.
* MAINT: Use list and dict comprehension when possible (#12445)Roman Yurchak2018-12-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use list comprehension * More list comprehension migration * Revert key copying in dict * A few more fixes * More reverts * Use dict comprehension * Fix dict comprehension * Address review comments * More review comments * Fix for empty unpacking of zip(* * Revert zip(* unpacking altogether * Fix dict copying * More simplifications
* DOC: Fix more typos in docs and comments.Dongjoon Hyun2016-02-251-1/+1
|
* BUG: Fix bugs in unused code paths.Charles Harris2014-08-011-56/+29
| | | | | | | | | The `getargspec` needed to import the disassembler to support parsing tuple arguments. Since numpy never uses those, the corresponding code is deleted and an TypeError raised if such arguments are encountered. Also fix the unused formatargs function so it does not require the string module.
* 2to3: Apply types fixer.Charles Harris2013-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | Python 3 removes the builtin types from the types module. The types fixer replaces such references with the builtin types where possible and also takes care of some special cases: types.TypeNone <- type(None) types.NotImplementedType <- type(NotImplemented) types.EllipsisType <- type(Ellipsis) The only two tricky substitutions are types.StringType <- bytes types.LongType <- int These are fixed up to support both Python 3 and Python 2 code by importing the long and bytes types from numpy.compat. Closes #3240.
* 2to3: Apply `map` fixer.Charles Harris2013-04-101-1/+1
| | | | | | | | | | | | | | | | | | | In Python 3 `map` is an iterator while in Python 2 it returns a list. The simple fix applied by the fixer is to inclose all instances of map with `list(...)`. This is not needed in all cases, and even where appropriate list comprehensions may be preferred for their clarity. Consequently, this patch attempts to use list comprehensions where it makes sense. When the mapped function has two arguments there is another problem that can arise. In Python 3 map stops execution when the shortest argument list is exhausted, while in Python 2 it stops when the longest argument list is exhausted. Consequently the two argument case might need special care. However, we have been running Python3 converted versions of numpy since 1.5 without problems, so it is probably not something that affects us. Closes #3068
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-7/+7
| | | | | | | 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
* Merge pull request #3026 from charris/2to3-fix-printCharles Harris2013-03-011-0/+2
|\ | | | | 2to3: Put `from __future__ import division` in every python file.
| * 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.
* | 2to3: Apply `methodattrs` fixes.Charles Harris2013-03-011-1/+1
|/ | | | | Replaces old style `f.im_func` and `f.im_class` method attributes with `f.__func__` and `f.__class__`. Closes #3070.
* 2to3: Apply `funcattrs` fixer. Closes #3058.Charles Harris2013-02-281-4/+4
| | | | | This replaces the `b.func_xxxx` with newer `__xxxx__` attribute names For example, `f.__name__` replaces `f.func_name`
* ENH: Add some tools to numpy.compatPauli Virtanen2010-02-201-1/+1
|
* DOC: add docstrings to compat and compat._inspect.David Cournapeau2009-10-131-0/+7
|
* ENH: move inspect copy into newly created compat module.David Cournapeau2009-10-131-0/+212