python类iter_entry_points()的实例源码

hook.py 文件源码 项目:hookshub 作者: gisce 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def reload_hooks():
    # Update working set before using it
    import imp
    import pkg_resources
    imp.reload(pkg_resources)
    # Import plugin managers after reloading pkg_resources
    from hookshub.plugins import plugins
    from pkg_resources import working_set
    logger = logging.getLogger()
    for entrypoint in working_set.iter_entry_points('hookshub.plugins'):
        try:
            plugin = entrypoint.load()
        except Exception as e:
            logger.error('Could not load plugin {}:\n{}'.format(
                entrypoint, e
            ))
        else:
            plugins.register(plugin)
checkers.py 文件源码 项目:sndlatr 作者: Schibum 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _find_checkers():
    checkers = []
    try:
        from pkg_resources import working_set
    except ImportError:
        pass
    else:
        for entry_point in working_set.iter_entry_points('babel.checkers'):
            checkers.append(entry_point.load())
    if len(checkers) == 0:
        # if pkg_resources is not available or no usable egg-info was found
        # (see #230), just resort to hard-coded checkers
        return [num_plurals, python_format]
    return checkers
plugins.py 文件源码 项目:promgen 作者: line 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def discovery():
    return working_set.iter_entry_points('promgen.discovery')
plugins.py 文件源码 项目:promgen 作者: line 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def notifications():
    return working_set.iter_entry_points('promgen.notification')

# Since plugins may need to load other resources bundled with them, we loop
# through an additional promgen.apps entry point so that the default django
# project loaders work as expected. This also should simplfy some configuration
# for plugin authors
checkers.py 文件源码 项目:chalktalk_docs 作者: loremIpsum1771 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _find_checkers():
    checkers = []
    try:
        from pkg_resources import working_set
    except ImportError:
        pass
    else:
        for entry_point in working_set.iter_entry_points('babel.checkers'):
            checkers.append(entry_point.load())
    if len(checkers) == 0:
        # if pkg_resources is not available or no usable egg-info was found
        # (see #230), just resort to hard-coded checkers
        return [num_plurals, python_format]
    return checkers
checkers.py 文件源码 项目:enkiWS 作者: juliettef 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _find_checkers():
    checkers = []
    try:
        from pkg_resources import working_set
    except ImportError:
        pass
    else:
        for entry_point in working_set.iter_entry_points('babel.checkers'):
            checkers.append(entry_point.load())
    if len(checkers) == 0:
        # if pkg_resources is not available or no usable egg-info was found
        # (see #230), just resort to hard-coded checkers
        return [num_plurals, python_format]
    return checkers
checkers.py 文件源码 项目:Hawkeye 作者: tozhengxq 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _find_checkers():
    checkers = []
    try:
        from pkg_resources import working_set
    except ImportError:
        pass
    else:
        for entry_point in working_set.iter_entry_points('babel.checkers'):
            checkers.append(entry_point.load())
    if len(checkers) == 0:
        # if pkg_resources is not available or no usable egg-info was found
        # (see #230), just resort to hard-coded checkers
        return [num_plurals, python_format]
    return checkers


问题


面经


文章

微信
公众号

扫码关注公众号