black inserting blank lines in multiline strings
See original GitHub issueDescription
What steps will reproduce the problem?
-
Enable formatting with black on save.
-
turn off all the editor save options due to existing issue that causes it to break #1
-
Create a file with a multiline string, save it.
An extra blank line is inserted onto every line of the multistring.
- Make some minor edit, save again. Blank lines are inserted again.
I’ll upload a screen capture in a minute.
Versions
- Spyder version: 5.3.0
- Python version: 3.9.12
- Qt version: 5.15.2
- PyQt5 version: 5.15.6
- Operating System: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 2.0.0 (OK)
cookiecutter >=1.6.0 : 1.7.3 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree >=3.0.2 : 3.1.0 (OK)
IPython >=7.31.1;<8.0.0 : 7.33.0 (OK)
jedi >=0.17.2;<0.19.0 : 0.18.1 (OK)
jellyfish >=0.7 : 0.9.0 (OK)
jsonschema >=3.2.0 : 4.4.0 (OK)
keyring >=17.0.0 : 23.4.0 (OK)
nbconvert >=4.0 : 6.4.4 (OK)
numpydoc >=0.6.0 : 1.2 (OK)
paramiko >=2.4.0 : 2.8.1 (OK)
parso >=0.7.0;<0.9.0 : 0.8.3 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.8.0 (OK)
pygments >=2.0 : 2.11.2 (OK)
pylint >=2.5.0 : 2.9.6 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.4.1;<1.5.0 : 1.4.1 (OK)
pylsp_black >=1.2.0 : 1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0 : 3.0.2 (OK)
qstylizer >=0.1.10 : 0.1.10 (OK)
qtawesome >=1.0.2 : 1.0.3 (OK)
qtconsole >=5.3.0;<5.4.0 : 5.3.0 (OK)
qtpy >=2.0.1 : 2.0.1 (OK)
rtree >=0.9.7 : 0.9.7 (OK)
setuptools >=49.6.0 : 61.2.0 (OK)
sphinx >=0.6.6 : 4.4.0 (OK)
spyder_kernels >=2.3.0;<2.4.0 : 2.3.0 (OK)
textdistance >=4.2.0 : 4.2.1 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog >=0.10.3 : 2.1.6 (OK)
zmq >=17 : 22.3.0 (OK)
# Optional:
cython >=0.21 : 0.29.28 (OK)
matplotlib >=3.0.0 : 3.5.1 (OK)
numpy >=1.7 : 1.21.5 (OK)
pandas >=1.1.1 : 1.4.2 (OK)
scipy >=0.17.0 : 1.7.3 (OK)
sympy >=0.7.3 : 1.10.1 (OK)
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Black should have an opinion about empty line after ...
Insert a blank line after all docstrings (one-line or multi-line) that document a class -- generally speaking, the class's methods are ...
Read more >The Black code style - Black 22.12.0 documentation
Black won't insert empty lines after function docstrings unless that empty line is required due to an inner function starting immediately after.
Read more >What's a quick one-liner to remove empty lines from a ...
Show activity on this post. This code removes empty lines (with or without whitespaces). import re re.sub(r'\n\s*\n', '\n', text, flags=re.MULTILINE).
Read more >Chapter 3 - Code Formatting with Black
This chapter introduces you to Black, a code formatting tool that can ... PEP 8 has several guidelines for inserting blank lines in...
Read more >Solved: Removing blank lines - Power Platform Community
Initialize String variable-Breakline, and add a carriage return inside Value. · Initialize another String variable to store the expected result. · Use the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, I updated to 5.3.1, same issue.
spyder.init.txt
I uploaded all of my settings in case that helps - had to rename with .txt to be able to upload.
I am going on vacation and won’t be able to deal with this for a few weeks. But if you can’t duplicate, if you wanted to you could point me to a few places in the spyder source code to look at where this might be happening once I’m back. I’m not terribly familiar with the source and am having trouble finding it myself.
Ok, I’m going to close this issue because we were unable to reproduce it.