Python pkg_resources.working_set 模块,iter_entry_points() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用pkg_resources.working_set.iter_entry_points()

项目:hookshub    作者:gisce    | 项目源码 | 文件源码
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)
项目:sndlatr    作者:Schibum    | 项目源码 | 文件源码
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
项目:promgen    作者:line    | 项目源码 | 文件源码
def discovery():
    return working_set.iter_entry_points('promgen.discovery')
项目:promgen    作者:line    | 项目源码 | 文件源码
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
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
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
项目:enkiWS    作者:juliettef    | 项目源码 | 文件源码
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
项目:Hawkeye    作者:tozhengxq    | 项目源码 | 文件源码
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