##// END OF EJS Templates
Merge pull request #6436 from thomasballinger/fix-6430...
Merge pull request #6436 from thomasballinger/fix-6430 Saving future compile directives from ipython -i

File last commit:

r17883:30e10449
r18549:f1dc401d merge
Show More
clearoutput.py
28 lines | 963 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 = []
Jessica B. Hamrick
Use cell.prompt_number rather than cell['prompt_number']
r17883 cell.prompt_number = None
Julia Evans
Add preprocessor that clears cell outputs
r16295 return cell, resources