The internal servers have no access to outside package repositories and run Python 3.8/3.9, so the UI moves from hand-drawn curses to Textual 6.2.1 (the last release supporting 3.8.1), vendored with its pure-Python dependencies in vendor/. The launcher puts vendor/ first on sys.path, so a plain checkout runs with no pip and no network. - dsflow/: the single script split into a package (pure moves of the backend sections); action rules moved to ops.py, free of Textual - dsflow/ui/: tabs, detail pane, live sanity-run panel, log viewer, modal dialogs, filter, themes, mouse support - tests/test_ui.py: headless UI tests through Textual's pilot - tools/vendor.py (refresh vendor/), tools/screenshots.py (README images) - README, CLAUDE.md, TODO and the feature doc updated for the new layout, the Python 3.8.1 floor and the vendoring rules Verified: 11 tests green on Python 3.12 and 3.8.20; the shipped file set runs under `python -I -S` on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
71 lines
1.7 KiB
Python
Vendored
71 lines
1.7 KiB
Python
Vendored
"""
|
|
pygments.console
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
Format colored console output.
|
|
|
|
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
|
: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["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 dark, light in zip(dark_colors, light_colors):
|
|
codes[dark] = esc + "%im" % x
|
|
codes[light] = esc + "%im" % (60 + x)
|
|
x += 1
|
|
|
|
del dark, light, 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)
|