예제 #1
0
def export_evaluated(nb, dest_path=None, skip_exceptions=False):
    """Convert notebook to an evaluated notebook.

    Optionally saves the notebook to dest_path.
    """
    nb_runner = NotebookRunner(nb)
    nb_runner.run_notebook(skip_exceptions=skip_exceptions)

    if dest_path is not None:
        with open(dest_path, 'w') as f:
            write_nb(nb_runner.nb, f)
    return nb_runner.nb
예제 #2
0
def export_evaluated(nb, dest_path=None, skip_exceptions=False):
    """Convert notebook to an evaluated notebook.

    Optionally saves the notebook to dest_path.
    """
    nb_runner = NotebookRunner(nb)
    nb_runner.run_notebook(skip_exceptions=skip_exceptions)

    if dest_path is not None:
        with io.open(dest_path, 'w', encoding='utf-8') as f:
            if IPython.version_info[0] <= 2:
                write_nb(nb_runner.nb, f, 'ipynb')
            else:
                write_nb(nb_runner.nb, f)
    return nb_runner.nb
예제 #3
0
파일: ipython.py 프로젝트: 4n6strider/nengo
def export_evaluated(nb, dest_path=None, skip_exceptions=False):
    """Convert notebook to an evaluated notebook.

    Optionally saves the notebook to dest_path.
    """
    nb_runner = NotebookRunner(nb)
    nb_runner.run_notebook(skip_exceptions=skip_exceptions)

    if dest_path is not None:
        with io.open(dest_path, 'w', encoding='utf-8') as f:
            if IPython.version_info[0] <= 2:
                write_nb(nb_runner.nb, f, 'ipynb')
            else:
                write_nb(nb_runner.nb, f)
    return nb_runner.nb