本文整理汇总了Python中pygments.styles.get_all_styles方法的典型用法代码示例。如果您正苦于以下问题:Python styles.get_all_styles方法的具体用法?Python styles.get_all_styles怎么用?Python styles.get_all_styles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygments.styles
的用法示例。
在下文中一共展示了styles.get_all_styles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: in_prompt_tokens
# 需要导入模块: from pygments import styles [as 别名]
# 或者: from pygments.styles import get_all_styles [as 别名]
def in_prompt_tokens(self, cli=None):
session = self.shell.user_module.session
style = session.GetParameter("highlighting_style")
old_style = self.shell.highlighting_style
if style != old_style:
try:
self.shell.highlighting_style = style
except Exception:
self.shell.highlighting_style = old_style
session.logging.error(
"Style %s not valid. Valid styles are %s" %
(style, list(styles.get_all_styles())))
return [
(Token.Prompt, "["),
(Token.Name.Variable, str(session.session_id)),
(Token.Prompt, "] "),
(Token.Name.Class, str(session.session_name)),
(Token.Prompt, " "),
(Token.Comment, time.strftime("%H:%M:%S")),
(Token.Prompt, "> "),
]
示例2: get_all_code_styles
# 需要导入模块: from pygments import styles [as 别名]
# 或者: from pygments.styles import get_all_styles [as 别名]
def get_all_code_styles() -> Dict[str, BaseStyle]:
"""
Return a mapping from style names to their classes.
"""
result: Dict[str, BaseStyle] = {
name: style_from_pygments_cls(get_style_by_name(name))
for name in get_all_styles()
}
result["win32"] = Style.from_dict(win32_code_style)
return result
示例3: get_available_syntax_styles
# 需要导入模块: from pygments import styles [as 别名]
# 或者: from pygments.styles import get_all_styles [as 别名]
def get_available_syntax_styles(self):
"""Get a list with the syntax styles available."""
styles = list(get_all_styles())
return sorted(styles)
示例4: generate_built_in_styles
# 需要导入模块: from pygments import styles [as 别名]
# 或者: from pygments.styles import get_all_styles [as 别名]
def generate_built_in_styles():
"""
Return a mapping from style names to their classes.
"""
return dict((name, get_editor_style_by_name(name)) for name in get_all_styles())
示例5: _print_list
# 需要导入模块: from pygments import styles [as 别名]
# 或者: from pygments.styles import get_all_styles [as 别名]
def _print_list(what):
if what == 'lexer':
print()
print("Lexers:")
print("~~~~~~~")
info = []
for fullname, names, exts, _ in get_all_lexers():
tup = (', '.join(names)+':', fullname,
exts and '(filenames ' + ', '.join(exts) + ')' or '')
info.append(tup)
info.sort()
for i in info:
print(('* %s\n %s %s') % i)
elif what == 'formatter':
print()
print("Formatters:")
print("~~~~~~~~~~~")
info = []
for cls in get_all_formatters():
doc = docstring_headline(cls)
tup = (', '.join(cls.aliases) + ':', doc, cls.filenames and
'(filenames ' + ', '.join(cls.filenames) + ')' or '')
info.append(tup)
info.sort()
for i in info:
print(('* %s\n %s %s') % i)
elif what == 'filter':
print()
print("Filters:")
print("~~~~~~~~")
for name in get_all_filters():
cls = find_filter_class(name)
print("* " + name + ':')
print(" %s" % docstring_headline(cls))
elif what == 'style':
print()
print("Styles:")
print("~~~~~~~")
for name in get_all_styles():
cls = get_style_by_name(name)
print("* " + name + ':')
print(" %s" % docstring_headline(cls))