@@ -190,7 +190,7 @@ def visit_funcdef(self, node: Node) -> Iterator[Line]:
190
190
if maybe_make_parens_invisible_in_atom (
191
191
child ,
192
192
parent = node ,
193
- remove_brackets_around_comma = False ,
193
+ remove_parens_around_comma = False ,
194
194
):
195
195
wrap_in_parentheses (node , child , visible = False )
196
196
else :
@@ -1011,7 +1011,7 @@ def remove_await_parens(node: Node) -> None:
1011
1011
if maybe_make_parens_invisible_in_atom (
1012
1012
node .children [1 ],
1013
1013
parent = node ,
1014
- remove_brackets_around_comma = True ,
1014
+ remove_parens_around_comma = True ,
1015
1015
):
1016
1016
wrap_in_parentheses (node , node .children [1 ], visible = False )
1017
1017
@@ -1046,7 +1046,7 @@ def remove_for_target_parens(node: Node, parent: Node) -> None:
1046
1046
# Parenthesized group of nodes/leaves, eg. `(x, y)`
1047
1047
# First try removing the group's surrounding parentheses.
1048
1048
if maybe_make_parens_invisible_in_atom (
1049
- node , parent , remove_brackets_around_comma = (parent .type == syms .for_stmt )
1049
+ node , parent , remove_parens_around_comma = (parent .type == syms .for_stmt )
1050
1050
):
1051
1051
wrap_in_parentheses (parent , node , visible = False )
1052
1052
# Then check if this atom could contain more atoms.
@@ -1082,7 +1082,7 @@ def remove_with_parens(node: Node, parent: Node) -> None:
1082
1082
if maybe_make_parens_invisible_in_atom (
1083
1083
node ,
1084
1084
parent = parent ,
1085
- remove_brackets_around_comma = True ,
1085
+ remove_parens_around_comma = True ,
1086
1086
):
1087
1087
wrap_in_parentheses (parent , node , visible = False )
1088
1088
if isinstance (node .children [1 ], Node ):
@@ -1097,15 +1097,16 @@ def remove_with_parens(node: Node, parent: Node) -> None:
1097
1097
if maybe_make_parens_invisible_in_atom (
1098
1098
node .children [0 ],
1099
1099
parent = node ,
1100
- remove_brackets_around_comma = True ,
1100
+ remove_parens_around_comma = True ,
1101
1101
):
1102
1102
wrap_in_parentheses (node , node .children [0 ], visible = False )
1103
1103
1104
1104
1105
1105
def maybe_make_parens_invisible_in_atom (
1106
1106
node : LN ,
1107
1107
parent : LN ,
1108
- remove_brackets_around_comma : bool = False ,
1108
+ * ,
1109
+ remove_parens_around_comma : bool = False ,
1109
1110
) -> bool :
1110
1111
"""If it's safe, make the parens in the atom `node` invisible, recursively.
1111
1112
Additionally, remove repeated, adjacent invisible parens from the atom `node`
@@ -1119,10 +1120,10 @@ def maybe_make_parens_invisible_in_atom(
1119
1120
or is_one_tuple (node )
1120
1121
or (is_yield (node ) and parent .type != syms .expr_stmt )
1121
1122
or (
1122
- # This condition tries to prevent removing non-optional brackets
1123
+ # This condition tries to prevent removing non-optional parentheses
1123
1124
# around a tuple, however, can be a bit overzealous so we provide
1124
1125
# and option to skip this check for `for` and `with` statements.
1125
- not remove_brackets_around_comma
1126
+ not remove_parens_around_comma
1126
1127
and max_delimiter_priority_in_atom (node ) >= COMMA_PRIORITY
1127
1128
)
1128
1129
):
@@ -1150,7 +1151,7 @@ def maybe_make_parens_invisible_in_atom(
1150
1151
maybe_make_parens_invisible_in_atom (
1151
1152
middle ,
1152
1153
parent = parent ,
1153
- remove_brackets_around_comma = remove_brackets_around_comma ,
1154
+ remove_parens_around_comma = remove_parens_around_comma ,
1154
1155
)
1155
1156
1156
1157
if is_atom_with_invisible_parens (middle ):
0 commit comments