Skip to content
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

Merged
merged 3 commits into from
Apr 23, 2019

Conversation

henriqueribeiro
Copy link
Contributor

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.


class ClearMetadataPreprocessor(Preprocessor):
"""
Removes the output from all code cells in a notebook.
Copy link
Member

@mpacer mpacer May 17, 2018

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.
Copy link
Member

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 = {}
Copy link
Member

@mpacer mpacer May 17, 2018

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?

Copy link
Contributor Author

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.

@henriqueribeiro
Copy link
Contributor Author

Docstrings updated

@henriqueribeiro
Copy link
Contributor Author

@mpacer Are the docstrings good now?

@henriqueribeiro
Copy link
Contributor Author

@mpacer any news about this? Thanks

@blink1073 blink1073 modified the milestones: 5.4, 5.5 Aug 29, 2018
@MSeal
Copy link
Contributor

MSeal commented Oct 28, 2018

@mpacer I'm good with merging this. Looks simple and straight forward. Any reasons not to add it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants