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

Add remove regex default to TemplateExporter, don't remove cells with outputs but no source #616

Merged
merged 7 commits into from
Jul 11, 2017

Conversation

mpacer
Copy link
Member

@mpacer mpacer commented Jun 28, 2017

Closes #615.

This enables RegexRemovePreprocessor in the TemplateExporter.

It also changes its behaviour to not remove cells that do have output even if they match the regular expression (which, by default, is the empty string).

@tillahoffmann is this consistent with your original intended use of this preprocessor (keeping in mind that tag-based input filtering should also be possible soon)?

Copy link
Contributor

@tillahoffmann tillahoffmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One small comment.

"""
Preprocessing to apply to each notebook. See base.py for details.
Checks that a cell matches the pattern and that (if a code cell)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here doesn't quite match the code below: The function checks that the cell does not match the pattern or is a code cell with output.

As an aside, are there any other cell types that can have output? We might just be able to check not pattern.match(cell.source) or cell.get('outputs'). Then cell.get('outputs') will evaluate to false if the key doesn't exist or the list is empty.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No other cell types have outputs, so we should be in the clear.

@minrk minrk merged commit bff8219 into jupyter:master Jul 11, 2017
@mpacer mpacer modified the milestone: 5.3 Aug 1, 2017
@mpacer mpacer added unlogged and removed unlogged labels Aug 31, 2017
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.

3 participants