@@ -24,7 +24,6 @@ class YapfBear(LocalBear):
24
24
LICENSE = 'AGPL-3.0'
25
25
CAN_FIX = {'Formatting' }
26
26
27
- # TODO Add coalesce_brackets once supported by yapf
28
27
@deprecate_settings (indent_size = 'tab_width' )
29
28
def run (self , filename , file ,
30
29
max_line_length : int = 79 ,
@@ -34,6 +33,7 @@ def run(self, filename, file,
34
33
continuation_tab_width : int = SpacingHelper .DEFAULT_TAB_WIDTH ,
35
34
dedent_closing_brackets : bool = False ,
36
35
indent_dictionary_value : bool = False ,
36
+ coalesce_brackets : bool = False ,
37
37
join_multiple_lines : bool = True ,
38
38
spaces_around_power_operator : bool = True ,
39
39
spaces_before_comment : int = 2 ,
@@ -64,6 +64,27 @@ def run(self, filename, file,
64
64
:param indent_dictionary_value:
65
65
Indents the dictionary value if it cannot fit on the same line as
66
66
the dictionary key.
67
+ :param coalesce_brackets:
68
+ Prevents splitting consecutive brackets. Only relevant when
69
+ ``dedent_closing_brackets`` is set.
70
+ Example:
71
+ If ``True``,
72
+
73
+ ```
74
+ call_func_that_takes_a_dict(
75
+ {
76
+ 'key1': 'value1',
77
+ 'key2': 'value2',
78
+ }
79
+ )
80
+ ```
81
+ would reformat to:
82
+ ```
83
+ call_func_that_takes_a_dict({
84
+ 'key1': 'value1',
85
+ 'key2': 'value2',
86
+ })
87
+ ```
67
88
:param join_multiple_lines:
68
89
Joins short lines into one line.
69
90
:param spaces_around_power_operator:
@@ -104,6 +125,7 @@ def run(self, filename, file,
104
125
join_multiple_lines = {join_multiple_lines}
105
126
spaces_around_power_operator = {spaces_around_power_operator}
106
127
spaces_before_comment = {spaces_before_comment}
128
+ coalesce_brackets = {coalesce_brackets}
107
129
split_before_bitwise_operator = {split_before_bitwise_operator}
108
130
split_before_first_argument = {split_before_first_argument}
109
131
split_before_logical_operator = {split_before_logical_operator}
0 commit comments