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.