This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".
The branch, python-formatting has been updated
via b107360d994dd97cbea8c6ded3364a0d843cd5bd (commit)
from e1e17c97a8ae35cfb6b2f7428fb52b05f82450d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -
commit b107360d994dd97cbea8c6ded3364a0d843cd5bd
Author: Eric Gallager
Date: Sun Aug 18 20:11:45 2024 -0400
Update gcc-color-to-html.py
apply flake8 formatting suggestions
diff --git a/bin/gcc-color-to-html.py b/bin/gcc-color-to-html.py
index 0d97ead4..18c63fda 100755
--- a/bin/gcc-color-to-html.py
+++ b/bin/gcc-color-to-html.py
@@ -25,37 +25,40 @@ import unittest
# Colors from gcc/color-macros.h:
-COLOR_SEPARATOR = ";"
-COLOR_NONE = "00"
-COLOR_BOLD = "01"
+COLOR_SEPARATOR = ";"
+COLOR_NONE = "00"
+COLOR_BOLD = "01"
COLOR_UNDERSCORE = "04"
-COLOR_BLINK = "05"
-COLOR_REVERSE= "07"
-COLOR_FG_BLACK = "30"
-COLOR_FG_RED = "31"
-COLOR_FG_GREEN = "32"
-COLOR_FG_YELLOW = "33"
-COLOR_FG_BLUE= "34"
+COLOR_BLINK = "05"
+COLOR_REVERSE = "07"
+COLOR_FG_BLACK = "30"
+COLOR_FG_RED = "31"
+COLOR_FG_GREEN = "32"
+COLOR_FG_YELLOW = "33"
+COLOR_FG_BLUE = "34"
COLOR_FG_MAGENTA = "35"
-COLOR_FG_CYAN= "36"
-COLOR_FG_WHITE = "37"
-COLOR_BG_BLACK = "40"
-COLOR_BG_RED = "41"
-COLOR_BG_GREEN = "42"
-COLOR_BG_YELLOW = "43"
-COLOR_BG_BLUE= "44"
+COLOR_FG_CYAN = "36"
+COLOR_FG_WHITE = "37"
+COLOR_BG_BLACK = "40"
+COLOR_BG_RED = "41"
+COLOR_BG_GREEN = "42"
+COLOR_BG_YELLOW = "43"
+COLOR_BG_BLUE = "44"
COLOR_BG_MAGENTA = "45"
-COLOR_BG_CYAN= "46"
-COLOR_BG_WHITE = "47"
+COLOR_BG_CYAN = "46"
+COLOR_BG_WHITE = "47"
SGR_START = "\33["
-SGR_END = "m\33[K"
+SGR_END = "m\33[K"
+
def SGR_SEQ(str):
return SGR_START + str + SGR_END
+
SGR_RESET = SGR_SEQ("")
+
def ansi_to_html(text):
text = html.escape(text)
pattern = ('(' + re.escape(SGR_START) + ')'
@@ -89,6 +92,7 @@ def ansi_to_html(text):
text = text[:m.start(1)] + replacement + text[m.end(3):]
return text
+
class AnsiToHtmlTests(unittest.TestCase):
def assert_html(self, ansi_text, expected_html):
html = ansi_to_html(ansi_text)
@@ -109,6 +113,7 @@ class AnsiToHtmlTests(unittest.TestCase):
def test_escaping(self):
self.assert_html("#include ", "#include ")
+
if len(sys.argv) > 1:
sys.exit(unittest.main())
---
Summary of changes:
bin/gcc-color-to-html.py | 45 +
1 file changed, 25 insertions(+), 20 deletions(-)
hooks/post-receive
--
gcc-wwwdocs