Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if skip_execute:
nbformat.write(notebook, open(dest_path, 'w'))
else:
ne = NotebookExporter()
newnb, _ = ne.from_notebook_node(notebook)
with open(dest_path,'w') as f:
f.write(newnb)
for pattern in patterns_to_take_with_me:
for f in glob.glob(os.path.join(os.path.dirname(nb_path),pattern)):
print("mv %s %s"%(f, os.path.dirname(dest_path)))
shutil.move(f,os.path.dirname(dest_path))
else:
print('INFO: Skipping existing evaluated notebook {dest_path!s}'.format(
dest_path=os.path.abspath(dest_path)))
preprocessors = [FixBackticksInDetails()]
if substring or offset:
preprocessors.append(NotebookSlice(substring, end, offset))
if skip_output:
preprocessors.append(SkipOutput(skip_output))
ret = nb_to_html(dest_path, preprocessors=preprocessors)
return ret