Page MenuHomeSolus

Update yapf to 0.30.0

Authored by xulongwu4 on Thu, Jun 25, 12:08 AM.



Update to 0.30.0.


  • Added SPACES_AROUND_LIST_DELIMITERS, SPACES_AROUND_DICT_DELIMITERS, and SPACES_AROUND_TUPLE_DELIMITERS to add spaces after the opening- and before the closing-delimiters for lists, dicts, and tuples.
  • Adds FORCE_MULTILINE_DICT knob to ensure dictionaries always split, even when shorter than the max line length.
  • New knob SPACE_INSIDE_BRACKETS to add spaces inside brackets, braces, and parentheses.
  • New knob SPACES_AROUND_SUBSCRIPT_COLON to add spaces around the subscript / slice operator.
  • Renamed "chromium" style to "yapf". Chromium will now use PEP-8 directly.
  • CONTINUATION_ALIGN_STYLE with FIXED or VALIGN-RIGHT now works with space indentation.
  • Honor a disable directive at the end of a multiline comment.
  • Don't require splitting before comments in a list when SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES is set. The knob is meant for values, not comments, which may be associated with the current line.
  • Don't over-indent a parameter list when not needed. But make sure it is properly indented so that it doesn't collide with the lines afterwards.
  • Don't split between two-word comparison operators: "is not", "not in", etc.
Test Plan

Used it to format a python file successfully.

Diff Detail

R4782 yapf
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

xulongwu4 created this revision.Thu, Jun 25, 12:08 AM
xulongwu4 requested review of this revision.Thu, Jun 25, 12:08 AM
xulongwu4 edited the summary of this revision. (Show Details)Thu, Jun 25, 12:11 AM
JoshStrobl accepted this revision.Fri, Jun 26, 9:16 AM
JoshStrobl added a subscriber: JoshStrobl.

LGTM, thanks!

This revision is now accepted and ready to land.Fri, Jun 26, 9:16 AM
This revision was automatically updated to reflect the committed changes.