yapf v0.20.0 Release Notes

Release Date: 2017-11-14 // over 6 years ago
  • โž• Added

    • ๐Ÿ‘Œ Improve splitting of comprehensions and generators. Add SPLIT_PENALTY_COMPREHENSION knob to control preference for keeping comprehensions on a single line and SPLIT_COMPLEX_COMPREHENSION to enable splitting each clause of complex comprehensions onto its own line. ### ๐Ÿ”„ Changed
    • Take into account a named function argument when determining if we should split before the first argument in a function call.
    • Split before the first argument in a function call if the arguments contain a dictionary that doesn't fit on a single line.
    • ๐Ÿ‘Œ Improve splitting of elements in a tuple. We want to split if there's a function call in the tuple that doesn't fit on the line. ### ๐Ÿ›  Fixed
    • Enforce spaces between ellipses and keywords.
    • When calculating the split penalty for a "trailer", process the child nodes afterwards because their penalties may change. For example if a list comprehension is an argument.
    • Don't enforce a split before a comment after the opening of a container if it doesn't it on the current line. We try hard not to move such comments around.
    • ๐Ÿ‘‰ Use a TextIOWrapper when reading from stdin in Python3. This is necessary for some encodings, like cp936, used on Windows.
    • โœ‚ Remove the penalty for a split before the first argument in a function call where the only argument is a generator expression.