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
dont skip formatting #%% #2919
Merged
Merged
dont skip formatting #%% #2919
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1059de1
dont skip formatting #%%
MarcoGorelli 8f6dcf7
use preview
MarcoGorelli 71ba4a7
fixup
MarcoGorelli 5f612b7
use preview=False in BlackBaseTestCase
MarcoGorelli 22a0d08
use self.mode.preview
MarcoGorelli e8ee4d5
shorten test file
MarcoGorelli File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# The percent-percent comments are Spyder IDE cells. | ||
# Both `#%%`` and `# %%` are accepted, so `black` standardises | ||
# to the latter. | ||
|
||
#%% | ||
def func(): | ||
x = """ | ||
a really long string | ||
""" | ||
lcomp3 = [ | ||
# This one is actually too long to fit in a single line. | ||
element.split("\n", 1)[0] | ||
# yup | ||
for element in collection.select_elements() | ||
# right | ||
if element is not None | ||
] | ||
# Capture each of the exceptions in the MultiError along with each of their causes and contexts | ||
if isinstance(exc_value, MultiError): | ||
embedded = [] | ||
for exc in exc_value.exceptions: | ||
if exc not in _seen: | ||
embedded.append( | ||
# This should be left alone (before) | ||
traceback.TracebackException.from_exception( | ||
exc, | ||
limit=limit, | ||
lookup_lines=lookup_lines, | ||
capture_locals=capture_locals, | ||
# copy the set of _seen exceptions so that duplicates | ||
# shared between sub-exceptions are not omitted | ||
_seen=set(_seen), | ||
) | ||
# This should be left alone (after) | ||
) | ||
|
||
# everything is fine if the expression isn't nested | ||
traceback.TracebackException.from_exception( | ||
exc, | ||
limit=limit, | ||
lookup_lines=lookup_lines, | ||
capture_locals=capture_locals, | ||
# copy the set of _seen exceptions so that duplicates | ||
# shared between sub-exceptions are not omitted | ||
_seen=set(_seen), | ||
) | ||
|
||
|
||
#%% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add an input comment that already has a space |
||
|
||
# output | ||
|
||
# The percent-percent comments are Spyder IDE cells. | ||
# Both `#%%`` and `# %%` are accepted, so `black` standardises | ||
# to the latter. | ||
|
||
# %% | ||
def func(): | ||
x = """ | ||
a really long string | ||
""" | ||
lcomp3 = [ | ||
# This one is actually too long to fit in a single line. | ||
element.split("\n", 1)[0] | ||
# yup | ||
for element in collection.select_elements() | ||
# right | ||
if element is not None | ||
] | ||
# Capture each of the exceptions in the MultiError along with each of their causes and contexts | ||
if isinstance(exc_value, MultiError): | ||
embedded = [] | ||
for exc in exc_value.exceptions: | ||
if exc not in _seen: | ||
embedded.append( | ||
# This should be left alone (before) | ||
traceback.TracebackException.from_exception( | ||
exc, | ||
limit=limit, | ||
lookup_lines=lookup_lines, | ||
capture_locals=capture_locals, | ||
# copy the set of _seen exceptions so that duplicates | ||
# shared between sub-exceptions are not omitted | ||
_seen=set(_seen), | ||
) | ||
# This should be left alone (after) | ||
) | ||
|
||
# everything is fine if the expression isn't nested | ||
traceback.TracebackException.from_exception( | ||
exc, | ||
limit=limit, | ||
lookup_lines=lookup_lines, | ||
capture_locals=capture_locals, | ||
# copy the set of _seen exceptions so that duplicates | ||
# shared between sub-exceptions are not omitted | ||
_seen=set(_seen), | ||
) | ||
|
||
|
||
# %% |
This file contains 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
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.
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.
Can we shorten this code? The test can focus on just
#%%
, so no need for everything else.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.
sure, I was meaning it to be a
--preview
version ofcomments3.py
- but shortening it and just testing# %%
seems fine