match
as the match keyword.--print-modified
flag to print out file names of modified files when running in in-place mode.# fmt: on
and # fmt: off
pragmas.yapf_api.FormatTree
for formatting lib2to3 concrete syntax trees.BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF
knob for “pep8” style, so method definitions inside a class are surrounded by a single blank line as prescribed by PEP8.# copybara:
directives when checking line length.SPACES_AROUND_LIST_DELIMITERS
, SPACES_AROUND_DICT_DELIMITERS
, and SPACES_AROUND_TUPLE_DELIMITERS
to add spaces after the opening- and before the closing-delimiters for lists, dicts, and tuples.FORCE_MULTILINE_DICT
knob to ensure dictionaries always split, even when shorter than the max line length.SPACE_INSIDE_BRACKETS
to add spaces inside brackets, braces, and parentheses.SPACES_AROUND_SUBSCRIPT_COLON
to add spaces around the subscript / slice operator.CONTINUATION_ALIGN_STYLE
with FIXED
or VALIGN-RIGHT
now works with space indentation.SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES
is set. The knob is meant for values, not comments, which may be associated with the current line.--quiet
flag to suppress output. The return code is 1 if there are changes, similarly to the --diff
flag.indent_closing_brackets
option. This is the same as the dedent_closing_brackets
option except the brackets are indented the same as the previous line.UnicodeDecodeError
exceptions.SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES
is a variation on SPLIT_ALL_COMMA_SEPARATED_VALUES
in which, if a subexpression with a comma fits in its starting line, then the subexpression is not split (thus avoiding unnecessary splits).INDENT_DICTIONARY_VALUE
for Google style.JOIN_MULTIPLE_LINES = False
for Google style.BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=False
wasn't honored because the number of newlines was erroneously calculated beforehand.SPLIT_BEFORE_ARITHMETIC_OPERATOR
splits before an arithmetic operator when set. SPLIT_PENALTY_ARITHMETIC_OPERATOR
allows you to set the split penalty around arithmetic operators.ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS
allows us to split before default / named assignments.ARITHMETIC_PRECEDENCE_INDICATION
removes spacing around binary operators if they have higher precedence than other operators in the same expression.SPACES_BEFORE_COMMENT
can now be assigned to a specific value (standard behavior) or a list of column values. When assigned to a list, trailing comments will be horizontally aligned to the first column value within the list that is greater than the maximum line length in the block.CONTINUATION_ALIGN_STYLE
to accept quoted or underline-separated option value for passing option with command line arguments.NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS
option enabled.INDENT_BLANK_LINES
knob to select whether the blank lines are empty or indented consistently with the current block.DEDENT_CLOSING_BRACKETS
enabled.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.BLANK_LINE_BEFORE_MODULE_DOCSTRING
knob adds a blank line before a module's docstring.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.SPLIT_BEFORE_CLOSING_BRACKET
knob to control whether closing bracket should get their own line.CONTINUATION_ALIGN_STYLE
knob to choose continuation alignment style when USE_TABS
is enabled.USE_TABS
is enabled.**foo
. Take that into account and don't split after the unpacking operator.dedent_closing_brackets
option requires that it be able to split there.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.SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN
that enforces a split after the opening paren of an expression that's surrounded by parens.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.NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS
prevents adding spaces around selected binary operators, in accordance with the current style guide.--lines
option.-vv
flag to print out file names as they are processedDEDENT_CLOSING_BRACKETS
and COALESCE_BRACKETS
interacted.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.SPLIT_BEFORE_DICT_SET_GENERATOR
knob splits before the for
part of a dictionary/set generator.BLANK_LINE_BEFORE_CLASS_DOCSTRING
knob adds a blank line before a class's docstring.ALLOW_MULTILINE_DICTIONARY_KEYS
knob allows dictionary keys to span more than one line.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.
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.