Commit Graph

4 Commits

Author SHA1 Message Date
Łukasz Langa
788268bc39 Re-implement magic trailing comma handling:
- when a trailing comma is specified in any bracket pair, that signals to Black
  that this bracket pair needs to be always exploded, e.g. presented as "one
  item per line";

- this causes some changes to previously formatted code that erroneously left
  trailing commas embedded into single-line expressions;

- internally, Black needs to be able to identify trailing commas that it put
  itself compared to pre-existing trailing commas. We do this by using/abusing
  lib2to3's `was_checked` attribute.  It's True for internally generated
  trailing commas and False for pre-existing ones (in fact, for all
  pre-existing leaves and nodes).

Fixes #1288
2020-08-21 16:45:30 +02:00
Łukasz Langa
6dca5278a3
Fix regression: unexpected parentheses around non-mathematical powers
This was caused by an overly liberal application of parentheses in #909 that
fixed #646.

Fixes #1041
2019-10-28 14:55:24 +01:00
Augie Fackler
9854d4b375 Tweak collection literals to explode with trailing comma (#826) 2019-10-20 16:08:34 +02:00
Łukasz Langa
f71db23824 Move test data to data 2018-06-06 15:48:38 -07:00