当前位置: 首页>>代码示例>>Python>>正文


Python styles.get_all_styles方法代码示例

本文整理汇总了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, "> "),
        ] 
开发者ID:google,项目名称:rekall,代码行数:24,代码来源:ipython_support.py

示例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 
开发者ID:prompt-toolkit,项目名称:ptpython,代码行数:12,代码来源:style.py

示例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) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:6,代码来源:mainwindow.py

示例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()) 
开发者ID:prompt-toolkit,项目名称:pyvim,代码行数:7,代码来源:style.py

示例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)) 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:51,代码来源:cmdline.py


注:本文中的pygments.styles.get_all_styles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。