##// END OF EJS Templates
Clear prompt numbers in clearoutput preprocessor
Clear prompt numbers in clearoutput preprocessor

File last commit:

r17853:2466a892
r17853:2466a892
Show More
clearoutput.py
29 lines | 1007 B | text/x-python | PythonLexer
"""Module containing a preprocessor that removes the outputs from code cells"""
# Copyright (c) IPython Development Team.
# 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 = []
if 'prompt_number' in cell:
del cell['prompt_number']
return cell, resources