aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py2/pygments/console.py
diff options
context:
space:
mode:
authorilezhankin <ilezhankin@yandex-team.ru>2022-02-10 16:45:55 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:55 +0300
commit1d125034f06575234f83f24f08677955133f140e (patch)
treeec05fbbd61dc118d5de37f206ab978cff58774bd /contrib/python/Pygments/py2/pygments/console.py
parent3a7a498715ef1b66f5054455421b845e45e3a653 (diff)
downloadydb-1d125034f06575234f83f24f08677955133f140e.tar.gz
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py2/pygments/console.py')
-rw-r--r--contrib/python/Pygments/py2/pygments/console.py114
1 files changed, 57 insertions, 57 deletions
diff --git a/contrib/python/Pygments/py2/pygments/console.py b/contrib/python/Pygments/py2/pygments/console.py
index a05b256e92..d46290eae2 100644
--- a/contrib/python/Pygments/py2/pygments/console.py
+++ b/contrib/python/Pygments/py2/pygments/console.py
@@ -1,71 +1,71 @@
-# -*- coding: utf-8 -*-
-"""
- pygments.console
- ~~~~~~~~~~~~~~~~
-
- Format colored console output.
-
+# -*- coding: utf-8 -*-
+"""
+ pygments.console
+ ~~~~~~~~~~~~~~~~
+
+ Format colored console output.
+
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
- :license: BSD, see LICENSE for details.
-"""
-
-esc = "\x1b["
-
-codes = {}
+ :license: BSD, see LICENSE for details.
+"""
+
+esc = "\x1b["
+
+codes = {}
codes[""] = ""
codes["reset"] = esc + "39;49;00m"
-
+
codes["bold"] = esc + "01m"
codes["faint"] = esc + "02m"
codes["standout"] = esc + "03m"
-codes["underline"] = esc + "04m"
+codes["underline"] = esc + "04m"
codes["blink"] = esc + "05m"
codes["overline"] = esc + "06m"
-
+
dark_colors = ["black", "red", "green", "yellow", "blue",
"magenta", "cyan", "gray"]
light_colors = ["brightblack", "brightred", "brightgreen", "brightyellow", "brightblue",
"brightmagenta", "brightcyan", "white"]
-
-x = 30
-for d, l in zip(dark_colors, light_colors):
- codes[d] = esc + "%im" % x
+
+x = 30
+for d, l in zip(dark_colors, light_colors):
+ codes[d] = esc + "%im" % x
codes[l] = esc + "%im" % (60 + x)
- x += 1
-
-del d, l, x
-
+ x += 1
+
+del d, l, x
+
codes["white"] = codes["bold"]
-
-
-def reset_color():
- return codes["reset"]
-
-
-def colorize(color_key, text):
- return codes[color_key] + text + codes["reset"]
-
-
-def ansiformat(attr, text):
- """
- Format ``text`` with a color and/or some attributes::
-
- color normal color
- *color* bold color
- _color_ underlined color
- +color+ blinking color
- """
- result = []
- if attr[:1] == attr[-1:] == '+':
- result.append(codes['blink'])
- attr = attr[1:-1]
- if attr[:1] == attr[-1:] == '*':
- result.append(codes['bold'])
- attr = attr[1:-1]
- if attr[:1] == attr[-1:] == '_':
- result.append(codes['underline'])
- attr = attr[1:-1]
- result.append(codes[attr])
- result.append(text)
- result.append(codes['reset'])
- return ''.join(result)
+
+
+def reset_color():
+ return codes["reset"]
+
+
+def colorize(color_key, text):
+ return codes[color_key] + text + codes["reset"]
+
+
+def ansiformat(attr, text):
+ """
+ Format ``text`` with a color and/or some attributes::
+
+ color normal color
+ *color* bold color
+ _color_ underlined color
+ +color+ blinking color
+ """
+ result = []
+ if attr[:1] == attr[-1:] == '+':
+ result.append(codes['blink'])
+ attr = attr[1:-1]
+ if attr[:1] == attr[-1:] == '*':
+ result.append(codes['bold'])
+ attr = attr[1:-1]
+ if attr[:1] == attr[-1:] == '_':
+ result.append(codes['underline'])
+ attr = attr[1:-1]
+ result.append(codes[attr])
+ result.append(text)
+ result.append(codes['reset'])
+ return ''.join(result)