##// END OF EJS Templates
Avoid duplicate extension in nbconvert...
Avoid duplicate extension in nbconvert nbconvert --to notebook --output Output.ipynb would write Output.ipynb.ipynb before this PR

File last commit:

r16296:a9860b18
r17309:9010f296
Show More
clearoutput.py
27 lines | 925 B | text/x-python | PythonLexer
Julia Evans
Add preprocessor that clears cell outputs
r16295 """Module containing a preprocessor that removes the outputs from code cells"""
Julia Evans
Fix copyright on clearoutput.py
r16296 # Copyright (c) IPython Development Team.
Julia Evans
Add preprocessor that clears cell outputs
r16295 # Distributed under the terms of the Modified BSD License.
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from .base import Preprocessor
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class ClearOutputPreprocessor(Preprocessor):
"""
Removes the output from all code cells in a notebook.
"""
def preprocess_cell(self, cell, resources, cell_index):
"""
Apply a transformation on each cell. See base.py for details.
"""
if cell.cell_type == 'code':
cell.outputs = []
return cell, resources