Yapf

Latest version: v0.40.2

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

Scan your dependencies

Page 3 of 10

0.24.0

Added
- Added 'SPLIT_BEFORE_DOT' knob to support "builder style" calls. The "builder
style" option didn't work as advertised. Lines would split after the dots,
not before them regardless of the penalties.
Changed
- Support Python 3.7 in the tests. The old "comp_for" and "comp_if" nodes are
now "old_comp_for" and "old_comp_if" in lib2to3.
Fixed
- Don't count inner function calls when marking arguments as named assignments.
- Make sure that tuples and the like are formatted nicely if they all can't fit
on a single line. This is similar to how we format function calls within an
argument list.
- Allow splitting in a subscript if it goes over the line limit.
- Increase the split penalty for an if-expression.
- Increase penalty for splitting in a subscript so that it's more likely to
split in a function call or other data literal.
- Cloning a pytree node doesn't transfer its a annotations. Make sure we do
that so that we don't lose information.
- Revert change that broke the "no_spaces_around_binary_operators" option.
- The "--style-help" option would output string lists and sets in Python types.
If the output was used as a style, then it wouldn't parse those values
correctly.

0.23.0

Added
- `DISABLE_ENDING_COMMA_HEURISTIC` is a new knob to disable the heuristic which
splits a list onto separate lines if the list is comma-terminated.
Fixed
- There's no need to increase N_TOKENS. In fact, it causes other things which
use lib2to3 to fail if called from YAPF.
- Change the exception message instead of creating a new one that's just a
clone.
- Make sure not to reformat when a line is disabled even if the --lines option
is specified.
- The "no spaces around operators" flag wasn't correctly converting strings to
sets. Changed the regexp to handle it better.

0.22.0

Added
- The `BLANK_LINE_BEFORE_MODULE_DOCSTRING` knob adds a blank line before a
module's docstring.
- The `SPLIT_ALL_COMMA_SEPARATED_VALUES` knob causes all lists, tuples, dicts
function defs, etc... to split on all values, instead of maximizing the
number of elements on each line, when not able to fit on a single line.
Changed
- Improve the heuristic we use to determine when to split at the start of a
function call. First check whether or not all elements can fit in the space
without wrapping. If not, then we split.
- Check all of the elements of a tuple. Similarly to how arguments are
analyzed. This allows tuples to be split more rationally.
- Adjust splitting penalties around arithmetic operators so that the code can
flow more freely. The code must flow!
- Try to meld an argument list's closing parenthesis to the last argument.
Fixed
- Attempt to determine if long lambdas are allowed. This can be done on a
case-by-case basis with a "pylint" disable comment.
- A comment before a decorator isn't part of the decorator's line.
- Only force a new wrapped line after a comment in a decorator when it's the
first token in the decorator.

0.21.0

Added
- Introduce a new option of formatting multiline literals. Add
`SPLIT_BEFORE_CLOSING_BRACKET` knob to control whether closing bracket should
get their own line.
- Added `CONTINUATION_ALIGN_STYLE` knob to choose continuation alignment style
when `USE_TABS` is enabled.
- Add 'BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION' knob to control the number
of blank lines between top-level function and class definitions.
Fixed
- Don't split ellipses.

0.20.2

Changed
- Improve the speed at which files are excluded by ignoring them earlier.
- Allow dictionaries to stay on a single line if they only have one entry
Fixed
- Use tabs when constructing a continuation line when `USE_TABS` is enabled.
- A dictionary entry may not end in a colon, but may be an "unpacking"
operation: `**foo`. Take that into account and don't split after the
unpacking operator.

0.20.1

Fixed
- Don't treat 'None' as a keyword if calling a function on it, like '__ne__()'.
- use_tabs=True always uses a single tab per indentation level; spaces are
used for aligning vertically after that.
- Relax the split of a paren at the end of an if statement. With
`dedent_closing_brackets` option requires that it be able to split there.

Page 3 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.