8000 Merge pull request #3049 from charris/2to3-exec · numpy/numpy@2cb5021 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cb5021

Browse files
committed
Merge pull request #3049 from charris/2to3-exec
2to3: apply exec fixer results.
2 parents ceca28d + 2429298 commit 2cb5021

File tree

14 files changed

+21
-21
lines changed

14 files changed

+21
-21
lines changed

doc/numpybook/runcode.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def getoutput(tstr, dic):
3333
except SyntaxError:
3434
try:
3535
res = None
36-
exec code in dic
36+
exec(code, dic)
3737
finally:
3838
sys.stdout = sys.__stdout__
3939
if res is None:
@@ -94,8 +94,8 @@ def runpycode(lyxstr, name='MyCode'):
9494
del indx[0]
9595
indx.append(len(lyxstr))
9696
edic = {}
97-
exec 'from numpy import *' in edic
98-
exec 'set_printoptions(linewidth=65)' in edic
97+
exec('from numpy import *', edic)
98+
exec('set_printoptions(linewidth=65)', edic)
9999
# indx now contains [st0,en0, ..., stN,enN]
100100
# where stX is the start of code segment X
101101
# and enX is the start of \layout MyCode for
@@ -109,8 +109,8 @@ def runpycode(lyxstr, name='MyCode'):
109109
# if PYNEW found, then start a new namespace
110110
if mat:
111111
edic = {}
112-
exec 'from numpy import *' in edic
113-
exec 'set_printoptions(linewidth=65)' in edic
112+
exec('from numpy import *', edic)
113+
exec('set_printoptions(linewidth=65)', edic)
114114
# now find the code in the code segment
115115
# endoutput will contain the index just past any output
116116
# already present in the lyx string.

doc/sphinxext/plot_directive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ def run_code(code, code_path, ns=None):
456456
if ns is None:
457457
ns = {}
458458
if not ns:
459-
exec setup.config.plot_pre_code in ns
460-
exec code in ns
459+
exec(setup.config.plot_pre_code, ns)
460+
exec(code, ns)
461461
except (Exception, SystemExit) as err:
462462
raise PlotError(traceback.format_exc())
463463
finally:

numpy/_import_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _init_info_modules(self, packages=None):
6666
break
6767
else:
6868
try:
69-
exec 'import %s.info as info' % (package_name)
69+
exec('import %s.info as info' % (package_name))
7070
info_modules[package_name] = info
7171
except ImportError as msg:
7272
self.warn('No scipy-style subpackage %r found in %s. '\

numpy/f2py/tests/test_array_from_pyobj.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,14 @@ def test_inplace_from_casttype(self):
530530

531531

532532
for t in Type._type_names:
533-
exec '''\
533+
exec('''\
534534
class test_%s_gen(unittest.TestCase,
535535
_test_shared_memory
536536
):
537537
def setUp(self):
538538
self.type = Type(%r)
539539
array = lambda self,dims,intent,obj: Array(Type(%r),dims,intent,obj)
540-
''' % (t,t,t)
540+
''' % (t,t,t))
541541

542542
if __name__ == "__main__":
543543
setup()

numpy/lib/function_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,7 @@ def add_newdoc(place, obj, doc):
32393239
"""
32403240
try:
32413241
new = {}
3242-
exec 'from %s import %s' % (place, obj) in new
3242+
exec('from %s import %s' % (place, obj), new)
32433243
if isinstance(doc, str):
32443244
add_docstring(new[obj], doc.strip())
32453245
elif isinstance(doc, tuple):

numpy/numarray/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _loadmodule(module):
168168
s = ""
169169
for i in range(len(modules)):
170170
s = ".".join(modules[:i+1])
171-
exec "import " + s
171+
exec("import " + s)
172172
return sys.modules[module]
173173

174174
class _ObjectProxy(object):

numpy/polynomial/chebyshev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2012,4 +2012,4 @@ def chebpts2(npts):
20122012
# Chebyshev series class
20132013
#
20142014

2015-
exec polytemplate.substitute(name='Chebyshev', nick='cheb', domain='[-1,1]')
2015+
exec(polytemplate.substitute(name='Chebyshev', nick='cheb', domain='[-1,1]'))

numpy/polynomial/hermite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1747,4 +1747,4 @@ def hermweight(x):
17471747
# Hermite series class
17481748
#
17491749

1750-
exec polytemplate.substitute(name='Hermite', nick='herm', domain='[-1,1]')
1750+
exec(polytemplate.substitute(name='Hermite', nick='herm', domain='[-1,1]'))

numpy/polynomial/hermite_e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,4 +1743,4 @@ def hermeweight(x):
17431743
# HermiteE series class
17441744
#
17451745

1746-
exec polytemplate.substitute(name='HermiteE', nick='herme', domain='[-1,1]')
1746+
exec(polytemplate.substitute(name='HermiteE', nick='herme', domain='[-1,1]'))

numpy/polynomial/laguerre.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,4 +1739,4 @@ def lagweight(x):
17391739
# Laguerre series class
17401740
#
17411741

1742-
exec polytemplate.substitute(name='Laguerre', nick='lag', domain='[-1,1]')
1742+
exec(polytemplate.substitute(name='Laguerre', nick='lag', domain='[-1,1]'))

0 commit comments

Comments
 (0)
0