Yapf

Latest version: v0.40.2

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

Scan your dependencies

Page 6 of 10

0.13.2

Fixed
- REGRESSION: A comment may have a prefix with newlines in it. When calculating
the prefix indent, we cannot take the newlines into account. Otherwise, the
comment will be misplaced causing the code to fail.

0.13.1

Fixed
- Correct emitting a diff that was accidentally removed.

0.13.0

Added
- Added support to retain the original line endings of the source code.

Fixed
- Functions or classes with comments before them were reformatting the comments
even if the code was supposed to be ignored by the formatter. We now don't
adjust the whitespace before a function's comment if the comment is a
"disabled" line. We also don't count " yapf: {disable|enable}" as a disabled
line, which seems logical.
- It's not really more readable to split before a dictionary value if it's part
of a dictionary comprehension.
- Enforce two blank lines after a function or class definition, even before a
comment. (But not between a decorator and a comment.) This is related to PEP8
error E305.
- Remove O(n^2) algorithm from the line disabling logic.

0.12.2

Fixed
- If `style.SetGlobalStyle(<create pre-defined style>)` was called and then
`yapf_api.FormatCode` was called, the style set by the first call would be
lost, because it would return the style created by `DEFAULT_STYLE_FACTORY`,
which is set to PEP8 by default. Fix this by making the first call set which
factory we call as the "default" style.
- Don't force a split before non-function call arguments.
- A dictionary being used as an argument to a function call and which can exist
on a single line shouldn't be split.
- Don't rely upon the original line break to determine if we should split
before the elements in a container. Especially split if there's a comment in
the container.
- Don't add spaces between star and args in a lambda expression.
- If a nested data structure terminates in a comma, then split before the first
element, but only if there's more than one element in the list.

0.12.1

Changed
- Dictionary values will be placed on the same line as the key if *all* of the
elements in the dictionary can be placed on one line. Otherwise, the
dictionary values will be placed on the next line.

Fixed
- Prefer to split before a terminating r-paren in an argument list if the line
would otherwise go over the column limit.
- Split before the first key in a dictionary if the dictionary cannot fit on a
single line.
- Don't count "pylint" comments when determining if the line goes over the
column limit.
- Don't count the argument list of a lambda as a named assign in a function
call.

0.12.0

Added
- Support formatting of typed names. Typed names are formatted a similar way to
how named arguments are formatted, except that there's a space after the
colon.
- Add a knob, 'SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN', to allow adding spaces
around the assign operator on default or named assigns.

Changed
- Turn "verification" off by default for external APIs.
- If a function call in an argument list won't fit on the current line but will
fit on a line by itself, then split before the call so that it won't be split
up unnecessarily.

Fixed
- Don't add space after power operator if the next operator's a unary operator.

Page 6 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.