Ignore all magics#6
Open
liurui39660 wants to merge 2 commits intocsurfer:masterfrom
liurui39660:master
Open
Conversation
added 2 commits
August 17, 2018 16:13
Fix: Ignore all magic calls.
Fix: Ignore all magic calls.
csurfer
requested changes
Aug 20, 2018
| if cell: | ||
| formated = format_str(src_contents=cell, line_length=line_length) | ||
| if formated and formated[-1] == "\n": | ||
| # Comment magics |
Owner
There was a problem hiding this comment.
Shall we leave a detailed comment on:
- Pattern the regex replacing and what it is replacing it with.
- Give an example.
| # Comment magics | ||
| cell = re.sub(r"^%", r"##!%", cell) | ||
| cell = re.sub(r"\n\s*%", "\n##!%", cell) | ||
| try: |
Owner
There was a problem hiding this comment.
This is a good logic! Can we abstract it out to a method and add tests for that method. It would be amazing if you can do that. Also, we should avoid exception based flow control.
| self.shell.set_next_input(formated, replace=True) | ||
| except ValueError as e: | ||
| formated = cell | ||
| print(e) |
Owner
There was a problem hiding this comment.
Maybe we should have logging.error() instead of printing the exception.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves #5
Fix:
%%blackwill be removed even formatting fails.Fix: Ignore all magic calls.