Black fails to format over-length line containing walrus operator (works on master)
See original GitHub issueDescribe the bug As per title - lines longer than 88 containing a walrus operator fail to be formatted.
It works on master though (tested in the online version)
To Reproduce Steps to reproduce the behavior:
- Take this code
longnamelongnamelongnamelongnamelongnamelongnamelongnamelongname = 5
if x := longnamelongnamelongnamelongnamelongnamelongnamelongnamelongname + longnamelongnamelongnamelongnamelongnamelongnamelongnamelongname:
print(x)
- Run Black on it
- See error
Expected behavior A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- Version: 19.10b0
- OS and Python version: windows 10, python 3.8.0
Does this bug also happen on master? It does work on master - tested on online version. Looks like we just need a new release.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Despite controversy, walrus operator is going to be like f ...
The long length of calls to "format" is what screws up your indentation, which then screws up the literals (or forces you to...
Read more >In python, how to tweak Black formatter, if possible?
This is due to the default line length for black being longer than you'd like – 88 characters per line. To decrease the...
Read more >Hyperion System 9 BI+ Production Reporting Developer's ...
first column. The characters "!=" denotes a relational operator, and Production. Reporting could confuse it with a comment where a relational argument could....
Read more >if you liked this book, try… - SCASL
SUMMARY: When Naomi's absent mother resurfaces to claim her, Naomi runs away to Mexico with her great-grandmother and younger brother in search of...
Read more >ALPS: A Bluetooth and Ultrasound Platform for Mapping and ...
classify if beacons are within Line-Of-Sight (LOS) to the mobile phone. ... tion with a Euclidean distance error of 16.1cm, and can gen-....
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 FreeTop 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
Top GitHub Comments
Do we have an approximate time of when the release will come up? 😃
I’m also running into an issue with the walrus operator, though it seems to be independent of line length. When running
black
on a file, it fails on this lineproviding
By removing the walrus operator from that line,
black
is successfully able to format the file.Environment
black
version 19.10bDoes this bug happen on master? No, this bug does not occur on the master branch. I agree with Martin about the new release.
Thanks for all of the work thus far! 👍