Skip to content
Snippets Groups Projects
Commit c40f9779 authored by Maurice Herné's avatar Maurice Herné
Browse files

Adds new built-in action to clear cell outputs

parent d010a068
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment