Skip to content

Commit 48c98b2

Browse files
committed
Simplify the conditional
1 parent d4a70e4 commit 48c98b2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

yapf/yapflib/format_decision_state.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,14 +572,12 @@ def SurroundedByParens(token):
572572
# length because we might wrap after it
573573
next_token = ending.next_token
574574
prev_token = opening.previous_token
575-
if split_before:
576-
if prev_token:
577-
clause_start = _PrevLogicalClause(prev_token)
578-
length += opening.total_length - clause_start.total_length
579-
else:
580-
if next_token:
581-
clause_end = _NextLogicalClause(next_token)
582-
length += clause_end.total_length - ending.total_length
575+
if split_before and prev_token:
576+
clause_start = _PrevLogicalClause(prev_token)
577+
length += opening.total_length - clause_start.total_length
578+
elif not split_before and next_token
579+
clause_end = _NextLogicalClause(next_token)
580+
length += clause_end.total_length - ending.total_length
583581
else:
584582
end_token = _LastTokenInLine(check_token)
585583
length = end_token.total_length + self.stack[-1].indent

0 commit comments

Comments
 (0)