4 ms·
I've got a python project where I've been pretty naughty with long lines containing sql queries. I found that running this tool over it resulted in some strang
by Fuzzwah 12y ago
I've got a python project where I've been pretty naughty with long lines containing sql queries.
I found that running this tool over it resulted in some strange new lines.
For example, this was my old hideously long line:
query_qual = "INSERT OR REPLACE INTO Qualifying (poleid, seasonid, race_week_num, carclassid, pole) values (%s%s, %s, %s, %s, %s)" % (race[u'seasonid'], race[u'race_week_num'], race[u'seasonid'], race[u'race_week_num'], race[u'carclassid'], pole)
Changed to this:
query_qual = "INSERT OR REPLACE INTO Qualifying (poleid, seasonid, race_week_num, carclassid, pole) values (%s%s, %s, %s, %s, %s)" % (
race[u'seasonid'], race[u'race_week_num'], race[
u'seasonid'
], race[u'race_week_num'], race[u'carclassid'], pole)
- Pirate-of-SV 12y agoYou could try set the line length penalty so something really high. That would probably sort things out.
- spott 12y agonewlines need to be escaped somehow (two newlines seems to do it), otherwise they are combined into the same line: Every word in this sentence was entered on a different line.
- eliben 12y agoFeel free to submit a Github issue for yapf
- hyperpallium 12y agoTo my eye, HN has rendered them identically. You can preserve literal whitespace on HN by indenting by two spaces (and a newline to separate the code formatting from ordinary text). it appears like this