-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ClearMetadata Preprocessor #805
Conversation
|
||
class ClearMetadataPreprocessor(Preprocessor): | ||
""" | ||
Removes the output from all code cells in a notebook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring seems to be copied and pasted — could you update it to reflect your intention for the class?
|
||
def preprocess_cell(self, cell, resources, cell_index): | ||
""" | ||
Apply a transformation on each cell. See base.py for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstring is not specific to the purpose you are aiming at here, could you make it more specific.
if cell.cell_type == 'code': | ||
# Remove metadata | ||
if 'metadata' in cell: | ||
cell.metadata = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takluyver we've had lots of issues about this — I actually think this is going to be one of the cleanest ways to implement this since it doesn't have exceptions or caveats. Just cleans everything (which from a version control perspective is what you want).
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version control was the purpose of develop this. With this feature it will be possible to apply a clean and smudge for notebooks.
Docstrings updated |
@mpacer Are the docstrings good now? |
@mpacer any news about this? Thanks |
@mpacer I'm good with merging this. Looks simple and straight forward. Any reasons not to add it? |
Very simple preprocessor that cleans all the metadata on the ipynb code cells.
This is good for apply a git filter in order to be able to git diff more easily.