summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-02-28 09:36:20 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-02-28 09:36:20 -0700
commit2429298dd8ddf797c3c89e65eb8a9b9e8f72a299 (patch)
treed55a7d00d01432143ab1a7aadfffd33c04dff4a1 /numpy
parent0934653e151969f6912c911b5113306bd5f450f1 (diff)
downloadnumpy-2429298dd8ddf797c3c89e65eb8a9b9e8f72a299.tar.gz
2to3: apply exec fixer results.
This changes the `exec` command to the `exec` function.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/_import_tools.py2
-rw-r--r--numpy/f2py/tests/test_array_from_pyobj.py4
-rw-r--r--numpy/lib/function_base.py2
-rw-r--r--numpy/numarray/session.py2
-rw-r--r--numpy/polynomial/chebyshev.py2
-rw-r--r--numpy/polynomial/hermite.py2
-rw-r--r--numpy/polynomial/hermite_e.py2
-rw-r--r--numpy/polynomial/laguerre.py2
-rw-r--r--numpy/polynomial/legendre.py2
-rw-r--r--numpy/polynomial/polynomial.py2
-rw-r--r--numpy/testing/numpytest.py2
-rw-r--r--numpy/testing/utils.py4
12 files changed, 14 insertions, 14 deletions
diff --git a/numpy/_import_tools.py b/numpy/_import_tools.py
index 6223dd57f..93fdaf3a8 100644
--- a/numpy/_import_tools.py
+++ b/numpy/_import_tools.py
@@ -66,7 +66,7 @@ class PackageLoader(object):
break
else:
try:
- exec 'import %s.info as info' % (package_name)
+ exec('import %s.info as info' % (package_name))
info_modules[package_name] = info
except ImportError as msg:
self.warn('No scipy-style subpackage %r found in %s. '\
diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py
index c1b927c1c..0d525f3cf 100644
--- a/numpy/f2py/tests/test_array_from_pyobj.py
+++ b/numpy/f2py/tests/test_array_from_pyobj.py
@@ -530,14 +530,14 @@ class _test_shared_memory:
for t in Type._type_names:
- exec '''\
+ exec('''\
class test_%s_gen(unittest.TestCase,
_test_shared_memory
):
def setUp(self):
self.type = Type(%r)
array = lambda self,dims,intent,obj: Array(Type(%r),dims,intent,obj)
-''' % (t,t,t)
+''' % (t,t,t))
if __name__ == "__main__":
setup()
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 02dd0ceaf..48fc0d898 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3239,7 +3239,7 @@ def add_newdoc(place, obj, doc):
"""
try:
new = {}
- exec 'from %s import %s' % (place, obj) in new
+ exec('from %s import %s' % (place, obj), new)
if isinstance(doc, str):
add_docstring(new[obj], doc.strip())
elif isinstance(doc, tuple):
diff --git a/numpy/numarray/session.py b/numpy/numarray/session.py
index 0982742ab..f95f5ec34 100644
--- a/numpy/numarray/session.py
+++ b/numpy/numarray/session.py
@@ -168,7 +168,7 @@ def _loadmodule(module):
s = ""
for i in range(len(modules)):
s = ".".join(modules[:i+1])
- exec "import " + s
+ exec("import " + s)
return sys.modules[module]
class _ObjectProxy(object):
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py
index afeafcb68..9576a4697 100644
--- a/numpy/polynomial/chebyshev.py
+++ b/numpy/polynomial/chebyshev.py
@@ -2012,4 +2012,4 @@ def chebpts2(npts):
# Chebyshev series class
#
-exec polytemplate.substitute(name='Chebyshev', nick='cheb', domain='[-1,1]')
+exec(polytemplate.substitute(name='Chebyshev', nick='cheb', domain='[-1,1]'))
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index 2beb848ae..b410902ea 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -1747,4 +1747,4 @@ def hermweight(x):
# Hermite series class
#
-exec polytemplate.substitute(name='Hermite', nick='herm', domain='[-1,1]')
+exec(polytemplate.substitute(name='Hermite', nick='herm', domain='[-1,1]'))
diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py
index c183a5a86..4d3bcd338 100644
--- a/numpy/polynomial/hermite_e.py
+++ b/numpy/polynomial/hermite_e.py
@@ -1743,4 +1743,4 @@ def hermeweight(x):
# HermiteE series class
#
-exec polytemplate.substitute(name='HermiteE', nick='herme', domain='[-1,1]')
+exec(polytemplate.substitute(name='HermiteE', nick='herme', domain='[-1,1]'))
diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py
index f0c1268bf..7b77ea819 100644
--- a/numpy/polynomial/laguerre.py
+++ b/numpy/polynomial/laguerre.py
@@ -1739,4 +1739,4 @@ def lagweight(x):
# Laguerre series class
#
-exec polytemplate.substitute(name='Laguerre', nick='lag', domain='[-1,1]')
+exec(polytemplate.substitute(name='Laguerre', nick='lag', domain='[-1,1]'))
diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py
index 0efd13ffa..5b88b6287 100644
--- a/numpy/polynomial/legendre.py
+++ b/numpy/polynomial/legendre.py
@@ -1765,4 +1765,4 @@ def legweight(x):
# Legendre series class
#
-exec polytemplate.substitute(name='Legendre', nick='leg', domain='[-1,1]')
+exec(polytemplate.substitute(name='Legendre', nick='leg', domain='[-1,1]'))
diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py
index 8d7251b19..e174fdd96 100644
--- a/numpy/polynomial/polynomial.py
+++ b/numpy/polynomial/polynomial.py
@@ -1489,4 +1489,4 @@ def polyroots(c):
# polynomial class
#
-exec polytemplate.substitute(name='Polynomial', nick='poly', domain='[-1,1]')
+exec(polytemplate.substitute(name='Polynomial', nick='poly', domain='[-1,1]'))
diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py
index f72626cf0..200c88b03 100644
--- a/numpy/testing/numpytest.py
+++ b/numpy/testing/numpytest.py
@@ -42,7 +42,7 @@ def importall(package):
continue
name = package_name+'.'+subpackage_name
try:
- exec 'import %s as m' % (name)
+ exec('import %s as m' % (name))
except Exception as msg:
print 'Failed importing %s: %s' %(name, msg)
continue
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 2d3965594..ecf9fb6bd 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -881,7 +881,7 @@ def assert_array_less(x, y, err_msg='', verbose=True):
header='Arrays are not less-ordered')
def runstring(astr, dict):
- exec astr in dict
+ exec(astr, dict)
def assert_string_equal(actual, desired):
"""
@@ -1108,7 +1108,7 @@ def measure(code_str,times=1,label=None):
elapsed = jiffies()
while i < times:
i += 1
- exec code in globs,locs
+ exec(code, globs,locs)
elapsed = jiffies() - elapsed
return 0.01*elapsed