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


Python ExtensionManager.names方法代码示例

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


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

示例1: get_available_plugins

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_available_plugins(namespace):
    """Return names of the available / installed plugins for a given namespace.
    """
    from stevedore.extension import ExtensionManager

    manager = ExtensionManager(namespace=namespace, invoke_on_load=False)
    return manager.names()
开发者ID:lyandut,项目名称:st2,代码行数:9,代码来源:loader.py

示例2: get_scripts_by_name

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_scripts_by_name(namespace):
    scripts_by_name = defaultdict(list)
    extension_manager = ExtensionManager(namespace, invoke_on_load=True)
    for name, extension in zip(extension_manager.names(), extension_manager.extensions):
        scripts_by_name[name].append(extension.obj)
    for name, scripts in scripts_by_name.items():
        scripts_by_name[name] = sorted(scripts, key=lambda x: x.priority)
    return scripts_by_name
开发者ID:invisibleroads,项目名称:invisibleroads,代码行数:10,代码来源:scripts.py

示例3: get_available_backends

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_available_backends():
    """
    Return names of the available / installed authentication backends.

    :rtype: ``list`` of ``str``
    """
    manager = ExtensionManager(namespace=BACKENDS_NAMESPACE, invoke_on_load=False)
    return manager.names()
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:10,代码来源:__init__.py

示例4: get_available_backends

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_available_backends():
    """
    Return names of the available / installed action runners.

    :rtype: ``list`` of ``str``
    """
    from stevedore.extension import ExtensionManager

    manager = ExtensionManager(namespace=BACKENDS_NAMESPACE, invoke_on_load=False)
    return manager.names()
开发者ID:lyandut,项目名称:st2,代码行数:12,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
    def __init__(self, loader):
        super(YamlTestLoader, self).__init__()
        self._loader = loader

        assertions = ExtensionManager(
            namespace='usagi.assertions',
        )
        test_parameters = ExtensionManager(
            namespace='usagi.parameters'
        )

        self._assertions_map = dict(
            (name, assertions[name].plugin)
            for name in assertions.names()
        )
        self._test_parameters = dict(
            (name, test_parameters[name].plugin)
            for name in test_parameters.names()
        )
开发者ID:sjagoe,项目名称:usagi,代码行数:21,代码来源:yaml_test_loader.py

示例6: get_available_plugins

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
 def get_available_plugins(cls, namespace=None):
     """
     Returns a dict of all the plugins that have been made available through the platform.
     """
     # Note: we're creating the extension manager lazily to ensure that the Python path
     # has been correctly set up. Trying to create this statically will fail, unfortunately.
     plugins = OrderedDict()
     extension_manager = ExtensionManager(namespace=namespace or cls.NAMESPACE)  # pylint: disable=no-member
     for plugin_name in extension_manager.names():
         plugins[plugin_name] = extension_manager[plugin_name].plugin
     return plugins
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:13,代码来源:plugins.py

示例7: __init__

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
 def __init__(self, filename):
     super(VarLoader, self).__init__()
     self.filename = filename
     loaders = ExtensionManager(
         namespace='usagi.var_loaders',
     )
     self.loaders = dict(
         (name, loaders[name].plugin)
         for name in loaders.names()
     )
     self.loader_keys = set(self.loaders.keys())
开发者ID:sjagoe,项目名称:usagi,代码行数:13,代码来源:var_loader.py

示例8: get_available_backends

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_available_backends(namespace, invoke_on_load=False):
    """
    Return names of the available / installed backends.

    :rtype: ``list`` of ``str``
    """
    # NOTE: We use lazy import because importing from stevedore adds significat import time
    # overhead to other modules which don't need this package (stevedore needs to inspect various
    # entrypoint files on disk for all the installed Python packages which is slow)
    from stevedore.extension import ExtensionManager

    manager = ExtensionManager(namespace=namespace, invoke_on_load=invoke_on_load)
    return manager.names()
开发者ID:StackStorm,项目名称:st2,代码行数:15,代码来源:driver_loader.py

示例9: Upload

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
class Upload(CommonLogic, Menu):

    def __init__(self, helpers):
        self.unpack_helpers(helpers)
        header = u'Upload'
        message = (u'Make sure updates are in "new" folder '
                   'then press "1" to start.')

        options = self.make_plugin_options()
        super(Upload, self).__init__(header, options, message)

    def make_plugin_options(self):
        plugin_options = []

        self.mgr = ExtensionManager(u'pyiupdater.uploaders')
        plugin_names = self.mgr.names()
        log.debug(u'Plugin names: {}'.format(plugin_names))

        for pgn in plugin_names:
            # passing none as a place holder for logic in
            # cli.ui.menu for processing of plugin menu creation
            # Logic will pass this to else since its len is
            # more then 2
            log.debug(u'Plugin name: {}'.format(pgn))
            option = (pgn, self.upload, None)
            plugin_options.append(option)
        plugin_options.append((u'Main Menu', self.done))

        return plugin_options

    def upload(self, name):
        # Load plugin & invoke upload method
        self.uploader.set_uploader(name)
        self.display_menu_header(u'{} Uploader'.format(name))
        try:
            self.uploader.upload()
            time.sleep(3)
        except Exception as e:
            msg = (u'Looks like you forgot to add USERNAME, PASSWORD '
                   'and/or REMOTE_DIR')
            self.display_msg(msg)
            log.debug(str(e), exc_info=True)
            input()
开发者ID:douglasmccormickjr,项目名称:PyiUpdater,代码行数:45,代码来源:upload.py

示例10: register_runners

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def register_runners(experimental=False, fail_on_failure=True):
    """
    Register runners
    """
    LOG.debug('Start : register runners')
    runner_count = 0

    manager = ExtensionManager(namespace=RUNNERS_NAMESPACE, invoke_on_load=False)
    extension_names = manager.names()

    for name in extension_names:
        LOG.debug('Found runner "%s"' % (name))

        manager = DriverManager(namespace=RUNNERS_NAMESPACE, invoke_on_load=False, name=name)
        runner_metadata = manager.driver.get_metadata()
        runner_count += register_runner(runner_metadata, experimental)

    LOG.debug('End : register runners')

    return runner_count
开发者ID:nzlosh,项目名称:st2,代码行数:22,代码来源:runnersregistrar.py

示例11: builder_names

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
 def builder_names(ext_mgr=None):
     if not ext_mgr:
         ext_mgr = ExtensionManager(BUILDER_DRIVER_NAMESPACE)
     return ext_mgr.names()
开发者ID:blueboxgroup,项目名称:giftwrap,代码行数:6,代码来源:__init__.py

示例12: get_data_type_by_name

# 需要导入模块: from stevedore.extension import ExtensionManager [as 别名]
# 或者: from stevedore.extension.ExtensionManager import names [as 别名]
def get_data_type_by_name():
    data_type_by_name = {}
    x_manager = ExtensionManager('crosscompute.types')
    for data_type_name, x in zip(x_manager.names(), x_manager.extensions):
        data_type_by_name[data_type_name] = x.plugin
    return data_type_by_name
开发者ID:poguez,项目名称:crosscompute,代码行数:8,代码来源:__init__.py


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