black produces unnecessary line breaks in a cell of jupyter notebook if there are one or more import statements #516
Labels
bug
Issue identified by VS Code Team member as probable bug
info-needed
Issue requires more information from poster
triage-needed
Issue is not triaged.
Diagnostic Data
Behaviour
Expected Behavior
Just like these code in one cell:
When formatting, it should produce a line break after the import statement.
Other line breaks are unnecessary and annoying.
Actual Behavior
It Sometimes produce formatted output like this:
Reproduction Steps:
It will Sometimes happen in large jupyter notebooks with many cells.
I find this issue in several notebooks containing private content. Here are an example file that could be shared:
main.zip
If it's hard to reproduce, I'm willing to help.
Logs:
I have set log level to trace but this issue disappears now.
Logs will be given when it happens again.
Outcome When Attempting Debugging Steps:
Did running it from the command line work?
The command is something like
D:/anaconda3/Scripts/black.exe --stdin-filename e:\Project\battery\datapreprocessing_and_plots.py -
It will get stuck since the file is
datapreprocessing_and_plots.ipynb
and there is no such file asdatapreprocessing_and_plots.py
.Extra Details
I have been in a workspace, but with only one root
e:\Project\battery
.Here are the settings from the workspace:
These are from settings.json of the profile:
There is no specific setting related to black or python in user settings.json.
The text was updated successfully, but these errors were encountered: