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


Python plugin.find_plugin_formatters方法代码示例

本文整理汇总了Python中pygments.plugin.find_plugin_formatters方法的典型用法代码示例。如果您正苦于以下问题:Python plugin.find_plugin_formatters方法的具体用法?Python plugin.find_plugin_formatters怎么用?Python plugin.find_plugin_formatters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygments.plugin的用法示例。


在下文中一共展示了plugin.find_plugin_formatters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_formatter_for_filename

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def get_formatter_for_filename(fn, **options):
    """Lookup and instantiate a formatter by filename pattern.

    Raises ClassNotFound if not found.
    """
    fn = basename(fn)
    for modname, name, _, filenames, _ in itervalues(FORMATTERS):
        for filename in filenames:
            if _fn_matches(fn, filename):
                if name not in _formatter_cache:
                    _load_formatters(modname)
                return _formatter_cache[name](**options)
    for cls in find_plugin_formatters():
        for filename in cls.filenames:
            if _fn_matches(fn, filename):
                return cls(**options)
    raise ClassNotFound("no formatter found for file name %r" % fn) 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:19,代码来源:__init__.py

示例2: get_formatter_for_filename

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def get_formatter_for_filename(fn, **options):
    """Lookup and instantiate a formatter by filename pattern.

    Raises ClassNotFound if not found.
    """
    fn = basename(fn)
    for modname, name, _, filenames, _ in FORMATTERS.values():
        for filename in filenames:
            if _fn_matches(fn, filename):
                if name not in _formatter_cache:
                    _load_formatters(modname)
                return _formatter_cache[name](**options)
    for cls in find_plugin_formatters():
        for filename in cls.filenames:
            if _fn_matches(fn, filename):
                return cls(**options)
    raise ClassNotFound("no formatter found for file name %r" % fn) 
开发者ID:pygments,项目名称:pygments,代码行数:19,代码来源:__init__.py

示例3: get_all_formatters

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def get_all_formatters():
    """Return a generator for all formatter classes."""
    # NB: this returns formatter classes, not info like get_all_lexers().
    for info in itervalues(FORMATTERS):
        if info[1] not in _formatter_cache:
            _load_formatters(info[0])
        yield _formatter_cache[info[1]]
    for _, formatter in find_plugin_formatters():
        yield formatter 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:11,代码来源:__init__.py

示例4: find_formatter_class

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def find_formatter_class(alias):
    """Lookup a formatter by alias.

    Returns None if not found.
    """
    for module_name, name, aliases, _, _ in itervalues(FORMATTERS):
        if alias in aliases:
            if name not in _formatter_cache:
                _load_formatters(module_name)
            return _formatter_cache[name]
    for _, cls in find_plugin_formatters():
        if alias in cls.aliases:
            return cls 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:15,代码来源:__init__.py

示例5: get_all_formatters

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def get_all_formatters():
    """Return a generator for all formatter classes."""
    # NB: this returns formatter classes, not info like get_all_lexers().
    for info in FORMATTERS.values():
        if info[1] not in _formatter_cache:
            _load_formatters(info[0])
        yield _formatter_cache[info[1]]
    for _, formatter in find_plugin_formatters():
        yield formatter 
开发者ID:pygments,项目名称:pygments,代码行数:11,代码来源:__init__.py

示例6: find_formatter_class

# 需要导入模块: from pygments import plugin [as 别名]
# 或者: from pygments.plugin import find_plugin_formatters [as 别名]
def find_formatter_class(alias):
    """Lookup a formatter by alias.

    Returns None if not found.
    """
    for module_name, name, aliases, _, _ in FORMATTERS.values():
        if alias in aliases:
            if name not in _formatter_cache:
                _load_formatters(module_name)
            return _formatter_cache[name]
    for _, cls in find_plugin_formatters():
        if alias in cls.aliases:
            return cls 
开发者ID:pygments,项目名称:pygments,代码行数:15,代码来源:__init__.py


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