Yapf

Latest version: v0.40.2

Safety actively analyzes 629564 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 10

0.20.0

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.

0.19.0

Added
- Added `SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN` that enforces a split
after the opening paren of an expression that's surrounded by parens.
Changed
- Split before the ending bracket of a comma-terminated tuple / argument list
if it's not a single element tuple / arg list.
Fixed
- Prefer to split after a comma in an argument list rather than in the middle
of an argument.
- A non-multiline string may have newlines if it contains continuation markers
itself. Don't add a newline after the string when retaining the vertical
space.
- Take into account the "async" keyword when determining if we must split
before the first argument.
- Increase affinity for "atom" arguments in function calls. This helps prevent
lists from being separated when they don't need to be.
- Don't place a dictionary argument on its own line if it's the last argument
in the function call where that function is part of a builder-style call.
- Append the "var arg" type to a star in a star_expr.

0.18.0

Added
- Option `ALLOW_SPLIT_BEFORE_DICT_VALUE` allows a split before a value. If
False, then it won't be split even if it goes over the column limit.
Changed
- Use spaces around the '=' in a typed name argument to align with 3.6 syntax.
Fixed
- Allow semicolons if the line is disabled.
- Fix issue where subsequent comments at decreasing levels of indentation
were improperly aligned and/or caused output with invalid syntax.
- Fix issue where specifying a line range removed a needed line before a
comment.
- Fix spacing between unary operators if one is 'not'.
- Indent the dictionary value correctly if there's a multi-line key.
- Don't remove needed spacing before a comment in a dict when in "chromium"
style.
- Increase indent for continuation line with same indent as next logical line
with 'async with' statement.

0.17.0

Added
- Option `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` prevents adding spaces
around selected binary operators, in accordance with the current style guide.
Changed
- Adjust blank lines on formatting boundaries when using the `--lines` option.
- Return 1 if a diff changed the code. This is in line with how GNU diff acts.
- Add `-vv` flag to print out file names as they are processed
Fixed
- Corrected how `DEDENT_CLOSING_BRACKETS` and `COALESCE_BRACKETS` interacted.
- Fix return value to return a boolean.
- Correct vim plugin not to clobber edited code if yapf returns an error.
- Ensured comma-terminated tuples with multiple elements are split onto separate lines.

0.16.3

Changed
- Add filename information to a ParseError exception.
Fixed
- A token that ends in a continuation marker may have more than one newline in
it, thus changing its "lineno" value. This can happen if multiple
continuation markers are used with no intervening tokens. Adjust the line
number to account for the lines covered by those markers.
- Make sure to split after a comment even for "pseudo" parentheses.

0.16.2

Fixed
- Treat expansion operators ('*', '**') in a similar way to function calls to
avoid splitting directly after the opening parenthesis.
- Increase the penalty for splitting after the start of a tuple.
- Increase penalty for excess characters.
- Check that we have enough children before trying to access them all.
- Remove trailing whitespaces from comments.
- Split before a function call in a list if the full list isn't able to fit on
a single line.
- Trying not to split around the '=' of a named assign.
- Changed split before the first argument behavior to ignore compound
statements like if and while, but not function declarations.
- Changed coalesce brackets not to line split before closing bracket.

Page 4 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.