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]>
62 lines
2.0 KiB
Python
Vendored
62 lines
2.0 KiB
Python
Vendored
"""
|
|
pygments.styles
|
|
~~~~~~~~~~~~~~~
|
|
|
|
Contains built-in styles.
|
|
|
|
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
|
:license: BSD, see LICENSE for details.
|
|
"""
|
|
|
|
from pygments.plugin import find_plugin_styles
|
|
from pygments.util import ClassNotFound
|
|
from pygments.styles._mapping import STYLES
|
|
|
|
#: A dictionary of built-in styles, mapping style names to
|
|
#: ``'submodule::classname'`` strings.
|
|
#: This list is deprecated. Use `pygments.styles.STYLES` instead
|
|
STYLE_MAP = {v[1]: v[0].split('.')[-1] + '::' + k for k, v in STYLES.items()}
|
|
|
|
#: Internal reverse mapping to make `get_style_by_name` more efficient
|
|
_STYLE_NAME_TO_MODULE_MAP = {v[1]: (v[0], k) for k, v in STYLES.items()}
|
|
|
|
|
|
def get_style_by_name(name):
|
|
"""
|
|
Return a style class by its short name. The names of the builtin styles
|
|
are listed in :data:`pygments.styles.STYLE_MAP`.
|
|
|
|
Will raise :exc:`pygments.util.ClassNotFound` if no style of that name is
|
|
found.
|
|
"""
|
|
if name in _STYLE_NAME_TO_MODULE_MAP:
|
|
mod, cls = _STYLE_NAME_TO_MODULE_MAP[name]
|
|
builtin = "yes"
|
|
else:
|
|
for found_name, style in find_plugin_styles():
|
|
if name == found_name:
|
|
return style
|
|
# perhaps it got dropped into our styles package
|
|
builtin = ""
|
|
mod = 'pygments.styles.' + name
|
|
cls = name.title() + "Style"
|
|
|
|
try:
|
|
mod = __import__(mod, None, None, [cls])
|
|
except ImportError:
|
|
raise ClassNotFound(f"Could not find style module {mod!r}" +
|
|
(builtin and ", though it should be builtin")
|
|
+ ".")
|
|
try:
|
|
return getattr(mod, cls)
|
|
except AttributeError:
|
|
raise ClassNotFound(f"Could not find style class {cls!r} in style module.")
|
|
|
|
|
|
def get_all_styles():
|
|
"""Return a generator for all styles by name, both builtin and plugin."""
|
|
for v in STYLES.values():
|
|
yield v[1]
|
|
for name, _ in find_plugin_styles():
|
|
yield name
|