Updated script that can be controled by Nodejs web app
This commit is contained in:
@ -0,0 +1,61 @@
|
||||
"""
|
||||
pygments.styles
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Contains built-in styles.
|
||||
|
||||
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from pip._vendor.pygments.plugin import find_plugin_styles
|
||||
from pip._vendor.pygments.util import ClassNotFound
|
||||
from pip._vendor.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
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,54 @@
|
||||
# Automatically generated by scripts/gen_mapfiles.py.
|
||||
# DO NOT EDIT BY HAND; run `tox -e mapfiles` instead.
|
||||
|
||||
STYLES = {
|
||||
'AbapStyle': ('pygments.styles.abap', 'abap', ()),
|
||||
'AlgolStyle': ('pygments.styles.algol', 'algol', ()),
|
||||
'Algol_NuStyle': ('pygments.styles.algol_nu', 'algol_nu', ()),
|
||||
'ArduinoStyle': ('pygments.styles.arduino', 'arduino', ()),
|
||||
'AutumnStyle': ('pygments.styles.autumn', 'autumn', ()),
|
||||
'BlackWhiteStyle': ('pygments.styles.bw', 'bw', ()),
|
||||
'BorlandStyle': ('pygments.styles.borland', 'borland', ()),
|
||||
'CoffeeStyle': ('pygments.styles.coffee', 'coffee', ()),
|
||||
'ColorfulStyle': ('pygments.styles.colorful', 'colorful', ()),
|
||||
'DefaultStyle': ('pygments.styles.default', 'default', ()),
|
||||
'DraculaStyle': ('pygments.styles.dracula', 'dracula', ()),
|
||||
'EmacsStyle': ('pygments.styles.emacs', 'emacs', ()),
|
||||
'FriendlyGrayscaleStyle': ('pygments.styles.friendly_grayscale', 'friendly_grayscale', ()),
|
||||
'FriendlyStyle': ('pygments.styles.friendly', 'friendly', ()),
|
||||
'FruityStyle': ('pygments.styles.fruity', 'fruity', ()),
|
||||
'GhDarkStyle': ('pygments.styles.gh_dark', 'github-dark', ()),
|
||||
'GruvboxDarkStyle': ('pygments.styles.gruvbox', 'gruvbox-dark', ()),
|
||||
'GruvboxLightStyle': ('pygments.styles.gruvbox', 'gruvbox-light', ()),
|
||||
'IgorStyle': ('pygments.styles.igor', 'igor', ()),
|
||||
'InkPotStyle': ('pygments.styles.inkpot', 'inkpot', ()),
|
||||
'LightbulbStyle': ('pygments.styles.lightbulb', 'lightbulb', ()),
|
||||
'LilyPondStyle': ('pygments.styles.lilypond', 'lilypond', ()),
|
||||
'LovelaceStyle': ('pygments.styles.lovelace', 'lovelace', ()),
|
||||
'ManniStyle': ('pygments.styles.manni', 'manni', ()),
|
||||
'MaterialStyle': ('pygments.styles.material', 'material', ()),
|
||||
'MonokaiStyle': ('pygments.styles.monokai', 'monokai', ()),
|
||||
'MurphyStyle': ('pygments.styles.murphy', 'murphy', ()),
|
||||
'NativeStyle': ('pygments.styles.native', 'native', ()),
|
||||
'NordDarkerStyle': ('pygments.styles.nord', 'nord-darker', ()),
|
||||
'NordStyle': ('pygments.styles.nord', 'nord', ()),
|
||||
'OneDarkStyle': ('pygments.styles.onedark', 'one-dark', ()),
|
||||
'ParaisoDarkStyle': ('pygments.styles.paraiso_dark', 'paraiso-dark', ()),
|
||||
'ParaisoLightStyle': ('pygments.styles.paraiso_light', 'paraiso-light', ()),
|
||||
'PastieStyle': ('pygments.styles.pastie', 'pastie', ()),
|
||||
'PerldocStyle': ('pygments.styles.perldoc', 'perldoc', ()),
|
||||
'RainbowDashStyle': ('pygments.styles.rainbow_dash', 'rainbow_dash', ()),
|
||||
'RrtStyle': ('pygments.styles.rrt', 'rrt', ()),
|
||||
'SasStyle': ('pygments.styles.sas', 'sas', ()),
|
||||
'SolarizedDarkStyle': ('pygments.styles.solarized', 'solarized-dark', ()),
|
||||
'SolarizedLightStyle': ('pygments.styles.solarized', 'solarized-light', ()),
|
||||
'StarofficeStyle': ('pygments.styles.staroffice', 'staroffice', ()),
|
||||
'StataDarkStyle': ('pygments.styles.stata_dark', 'stata-dark', ()),
|
||||
'StataLightStyle': ('pygments.styles.stata_light', 'stata-light', ()),
|
||||
'TangoStyle': ('pygments.styles.tango', 'tango', ()),
|
||||
'TracStyle': ('pygments.styles.trac', 'trac', ()),
|
||||
'VimStyle': ('pygments.styles.vim', 'vim', ()),
|
||||
'VisualStudioStyle': ('pygments.styles.vs', 'vs', ()),
|
||||
'XcodeStyle': ('pygments.styles.xcode', 'xcode', ()),
|
||||
'ZenburnStyle': ('pygments.styles.zenburn', 'zenburn', ()),
|
||||
}
|
Reference in New Issue
Block a user