Yapf

Latest version: v0.40.2

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

Scan your dependencies

Page 5 of 10

0.16.1

Changed
- Improved performance of cloning the format decision state object. This
improved the time in one *large* case from 273.485s to 234.652s.
- Relax the requirement that a named argument needs to be on one line. Going
over the column limit is more of an issue to pylint than putting named args
on multiple lines.
- Don't make splitting penalty decisions based on the original formatting. This
can and does lead to non-stable formatting, where yapf will reformat the same
code in different ways.
Fixed
- Ensure splitting of arguments if there's a named assign present.
- Prefer to coalesce opening brackets if it's not at the beginning of a
function call.
- Prefer not to squish all of the elements in a function call over to the
right-hand side. Split the arguments instead.
- We need to split a dictionary value if the first element is a comment anyway,
so don't force the split here. It's forced elsewhere.
- Ensure tabs are used for continued indentation when USE_TABS is True.

0.16.0

Added
- The `EACH_DICT_ENTRY_ON_SEPARATE_LINE` knob indicates that each dictionary
entry should be in separate lines if the full dictionary isn't able to fit on
a single line.
- The `SPLIT_BEFORE_DICT_SET_GENERATOR` knob splits before the `for` part of a
dictionary/set generator.
- The `BLANK_LINE_BEFORE_CLASS_DOCSTRING` knob adds a blank line before a
class's docstring.
- The `ALLOW_MULTILINE_DICTIONARY_KEYS` knob allows dictionary keys to span
more than one line.
Fixed
- Split before all entries in a dict/set or list maker when comma-terminated,
even if there's only one entry.
- Will now try to set O_BINARY mode on stdout under Windows and Python 2.
- Avoid unneeded newline transformation when writing formatted code to
output on (affects only Python 2)

0.15.2

Fixed
- Don't perform a global split when a named assign is part of a function call
which itself is an argument to a function call. I.e., don't cause 'a' to
split here:

func(a, b, c, d(x, y, z=42))
- Allow splitting inside a subscript if it's a logical or bitwise operating.
This should keep the subscript mostly contiguous otherwise.

0.15.1

Fixed
- Don't insert a space between a type hint and the '=' sign.
- The '' operator can be used in Python 3 for matrix multiplication. Give the
'' in the decorator a DECORATOR subtype to distinguish it.
- Encourage the formatter to split at the beginning of an argument list instead
of in the middle. Especially if the middle is an empty parameter list. This
adjusts the affinity of binary and comparison operators. In particular, the
"not in" and other such operators don't want to have a split after it (or
before it) if at all possible.

0.15.0

Added
- Keep type annotations intact as much as possible. Don't try to split the over
multiple lines.
Fixed
- When determining if each element in a dictionary can fit on a single line, we
are skipping dictionary entries. However, we need to ignore comments in our
calculations and implicitly concatenated strings, which are already placed on
separate lines.
- Allow text before a "pylint" comment.
- Also allow text before a "yapf: (disable|enable)" comment.

0.14.0

Added
- formatting can be run in parallel using the "-p" / "--parallel" flags.
Fixed
- "not in" and "is not" should be subtyped as binary operators.
- A non-Node dictionary value may have a comment before it. In those cases, we
want to avoid encompassing only the comment in pseudo parens. So we include
the actual value as well.
- Adjust calculation so that pseudo-parentheses don't count towards the total
line length.
- Don't count a dictionary entry as not fitting on a single line in a
dictionary.
- Don't count pseudo-parentheses in the length of the line.

Page 5 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.