From 172c0a78facd8f938629f216c95507bbfeddfe5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hakan=20=C3=87elik?= Date: Mon, 28 Sep 2020 22:55:35 +0300 Subject: [PATCH 1/1] Fix unnecessary if checks (#1728) --- src/black/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/black/__init__.py b/src/black/__init__.py index 9af5801..24e9d4e 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -859,9 +859,9 @@ def color_diff(contents: str) -> str: for i, line in enumerate(lines): if line.startswith("+++") or line.startswith("---"): line = "\033[1;37m" + line + "\033[0m" # bold white, reset - if line.startswith("@@"): + elif line.startswith("@@"): line = "\033[36m" + line + "\033[0m" # cyan, reset - if line.startswith("+"): + elif line.startswith("+"): line = "\033[32m" + line + "\033[0m" # green, reset elif line.startswith("-"): line = "\033[31m" + line + "\033[0m" # red, reset -- 2.39.5