1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

Merge pull request #477 from setrofim/master

utils/ipython: handle nbconvert import
This commit is contained in:
setrofim 2017-09-14 08:37:52 +01:00 committed by GitHub
commit adf13feb81

View File

@ -37,19 +37,22 @@ NBFORMAT_VERSION = 3
if IPython:
if LooseVersion('6.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('4.0.0'):
import nbformat
from jupyter_client.manager import KernelManager
try:
import nbformat
from jupyter_client.manager import KernelManager
def read_notebook(notebook_in): # pylint: disable=function-redefined
return nbformat.reads(notebook_in, NBFORMAT_VERSION) # pylint: disable=E1101
def read_notebook(notebook_in): # pylint: disable=function-redefined
return nbformat.reads(notebook_in, NBFORMAT_VERSION) # pylint: disable=E1101
def write_notebook(notebook, fout): # pylint: disable=function-redefined
nbformat.write(notebook, fout) # pylint: disable=E1101
def write_notebook(notebook, fout): # pylint: disable=function-redefined
nbformat.write(notebook, fout) # pylint: disable=E1101
NotebookNode = nbformat.NotebookNode # pylint: disable=E1101
NotebookNode = nbformat.NotebookNode # pylint: disable=E1101
IPYTHON_NBCONVERT_HTML = ['jupyter', 'nbconvert', '--to html']
IPYTHON_NBCONVERT_PDF = ['jupyter', 'nbconvert', '--to pdf']
IPYTHON_NBCONVERT_HTML = ['jupyter', 'nbconvert', '--to html']
IPYTHON_NBCONVERT_PDF = ['jupyter', 'nbconvert', '--to pdf']
except ImportError:
import_error_str = 'Please install "jupyter" as well as "ipython" packages.'
elif LooseVersion('4.0.0') > LooseVersion(IPython.__version__) >= LooseVersion('3.0.0'):
from IPython.kernel import KernelManager