def mpl_runner(safe_execfile):
    
    def mpl_execfile(fname,*where,**kw):
        """matplotlib-aware wrapper around safe_execfile.

        Its interface is identical to that of the :func:`execfile` builtin.

        This is ultimately a call to execfile(), but wrapped in safeties to
        properly handle interactive rendering."""

        import matplotlib
        import matplotlib.pylab as pylab

        #print '*** Matplotlib runner ***' # dbg
        # turn off rendering until end of script
        is_interactive = matplotlib.rcParams['interactive']
        matplotlib.interactive(False)
        safe_execfile(fname,*where,**kw)
        matplotlib.interactive(is_interactive)
        # make rendering call now, if the user tried to do it
        if pylab.draw_if_interactive.called:
            pylab.draw()
            pylab.draw_if_interactive.called = False

    return mpl_execfile
Power string by Knuth-Morris-Pratt
dataset/ETHPy150Open ipython/ipython-py3k/IPython/lib/pylabtools.py/mpl_runner--crossover with--dataset/ETHPy150Open jilljenn/tryalgo/tryalgo/knuth_morris_pratt_border.py/powerstring_by_border