diff --git a/src/Notebook_Processor/desired_state/cell_modifier.py b/src/Notebook_Processor/desired_state/cell_modifier.py index 39f40c0279314801bc252c78d4873f193b164883..b54343779050790e72512cc0fa6f99a994d9637d 100644 --- a/src/Notebook_Processor/desired_state/cell_modifier.py +++ b/src/Notebook_Processor/desired_state/cell_modifier.py @@ -124,6 +124,14 @@ class CellModifier(BaseModel): kwargs.setdefault("metadata", cell.metadata) return cell_class(**kwargs) + @staticmethod + def clear_outputs(cell: NotebookCellAnnotation, **kwargs) -> NotebookCellAnnotation: + """ + Clear the output of the cell + """ + cell.outputs = [] + return cell + # I don't want to remove this yet but I am unsure of the value of this function. # It is currently also broken due to isinstance not being able to handle complex annotations. # @staticmethod @@ -188,6 +196,7 @@ class CellModifier(BaseModel): DELETE = delete CLEAR = clear + CLEAR_OUTPUTS = clear_outputs # REPLACE_FIELDS = replace_fields REPLACE_IN_SOURCE = replace_in_source UPDATE_METADATA = update_metadata