コード例 #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
ファイル: ipython.py プロジェクト: sagarkurandwad/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
コード例 #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