black/src
Richard Si 1d2d7264ec
Fix incorrect space before colon in if/while stmts (#1655)
* Fix incorrect space before colon in if/while stmts

Previously Black would format this code

```
if (foo := True):
	print(foo)
```

as

```
if (foo := True) :
	print(foo)
```

adding an incorrect space after the RPAR. Buggy code in the
normalize_invisible_parens function caused the colon to be wrapped in
invisible parentheses. The LPAR of that pair was then prefixed with a
single space at the request of the whitespace function.

This commit fixes the accidental skipping of a pre-condition check
which must return True before parenthesis normalization of a specific
child Leaf or Node can happen. The pre-condition check being skipped
was why the colon was wrapped in invisible parentheses.

* Add an entry in CHANGES.md
2020-08-31 14:20:05 -07:00
..
black Fix incorrect space before colon in if/while stmts (#1655) 2020-08-31 14:20:05 -07:00
black_primer Primer update config - enable pytest (#1626) 2020-08-25 21:55:05 -07:00
blackd Refactor black into packages in src/ dir (#1376) 2020-05-08 08:50:50 -07:00
blib2to3 Re-implement magic trailing comma handling: 2020-08-21 16:45:30 +02:00