diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-02-28 09:36:20 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-02-28 09:36:20 -0700 |
commit | 2429298dd8ddf797c3c89e65eb8a9b9e8f72a299 (patch) | |
tree | d55a7d00d01432143ab1a7aadfffd33c04dff4a1 /doc | |
parent | 0934653e151969f6912c911b5113306bd5f450f1 (diff) | |
download | numpy-2429298dd8ddf797c3c89e65eb8a9b9e8f72a299.tar.gz |
2to3: apply exec fixer results.
This changes the `exec` command to the `exec` function.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/numpybook/runcode.py | 10 | ||||
-rw-r--r-- | doc/sphinxext/plot_directive.py | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/doc/numpybook/runcode.py b/doc/numpybook/runcode.py index 7e696c9b3..7ec303500 100644 --- a/doc/numpybook/runcode.py +++ b/doc/numpybook/runcode.py @@ -33,7 +33,7 @@ def getoutput(tstr, dic): except SyntaxError: try: res = None - exec code in dic + exec(code, dic) finally: sys.stdout = sys.__stdout__ if res is None: @@ -94,8 +94,8 @@ def runpycode(lyxstr, name='MyCode'): del indx[0] indx.append(len(lyxstr)) edic = {} - exec 'from numpy import *' in edic - exec 'set_printoptions(linewidth=65)' in edic + exec('from numpy import *', edic) + exec('set_printoptions(linewidth=65)', edic) # indx now contains [st0,en0, ..., stN,enN] # where stX is the start of code segment X # and enX is the start of \layout MyCode for @@ -109,8 +109,8 @@ def runpycode(lyxstr, name='MyCode'): # if PYNEW found, then start a new namespace if mat: edic = {} - exec 'from numpy import *' in edic - exec 'set_printoptions(linewidth=65)' in edic + exec('from numpy import *', edic) + exec('set_printoptions(linewidth=65)', edic) # now find the code in the code segment # endoutput will contain the index just past any output # already present in the lyx string. diff --git a/doc/sphinxext/plot_directive.py b/doc/sphinxext/plot_directive.py index a91b436a7..7fa827664 100644 --- a/doc/sphinxext/plot_directive.py +++ b/doc/sphinxext/plot_directive.py @@ -456,8 +456,8 @@ def run_code(code, code_path, ns=None): if ns is None: ns = {} if not ns: - exec setup.config.plot_pre_code in ns - exec code in ns + exec(setup.config.plot_pre_code, ns) + exec(code, ns) except (Exception, SystemExit) as err: raise PlotError(traceback.format_exc()) finally: |