Skip to content

Commit 3216b64

Browse files
committed
Simplify the conditional
1 parent f9b78b3 commit 3216b64

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

yapf/yapflib/format_decision_state.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,12 @@ def SurroundedByParens(token):
561561
# length because we might wrap after it
562562
next_token = ending.next_token
563563
prev_token = opening.previous_token
564-
if split_before:
565-
if prev_token:
566-
clause_start = _PrevLogicalClause(prev_token)
567-
length += opening.total_length - clause_start.total_length
568-
else:
569-
if next_token:
570-
clause_end = _NextLogicalClause(next_token)
571-
length += clause_end.total_length - ending.total_length
564+
if split_before and prev_token:
565+
clause_start = _PrevLogicalClause(prev_token)
566+
length += opening.total_length - clause_start.total_length
567+
elif not split_before and next_token
568+
clause_end = _NextLogicalClause(next_token)
569+
length += clause_end.total_length - ending.total_length
572570
else:
573571
end_token = _LastTokenInLine(check_token)
574572
length = end_token.total_length + self.stack[-1].indent

0 commit comments

Comments
 (0)