From 1b51e2c07887bdd0aa12f8e79215ea72cbbc2ab4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Tue, 8 May 2018 21:01:50 -0700 Subject: [PATCH 1/1] Automatic management of parentheses in `elif`, too --- black.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/black.py b/black.py index c2363e4..0fa9df0 100644 --- a/black.py +++ b/black.py @@ -1375,7 +1375,9 @@ class LineGenerator(Visitor[Line]): v = self.visit_stmt Ø: Set[str] = set() self.visit_assert_stmt = partial(v, keywords={"assert"}, parens={"assert", ","}) - self.visit_if_stmt = partial(v, keywords={"if", "else", "elif"}, parens={"if"}) + self.visit_if_stmt = partial( + v, keywords={"if", "else", "elif"}, parens={"if", "elif"} + ) self.visit_while_stmt = partial(v, keywords={"while", "else"}, parens={"while"}) self.visit_for_stmt = partial(v, keywords={"for", "else"}, parens={"for", "in"}) self.visit_try_stmt = partial( -- 2.39.5