本文整理汇总了Python中entrypoints.get_group_all方法的典型用法代码示例。如果您正苦于以下问题:Python entrypoints.get_group_all方法的具体用法?Python entrypoints.get_group_all怎么用?Python entrypoints.get_group_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entrypoints
的用法示例。
在下文中一共展示了entrypoints.get_group_all方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_backend
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def load_backend(backend_name):
# Static backends
if backend_name in MLFLOW_BACKENDS:
return MLFLOW_BACKENDS[backend_name]()
# backends from plugin
try:
backend_builder = entrypoints.get_single(ENTRYPOINT_GROUP_NAME,
backend_name).load()
return backend_builder()
except entrypoints.NoSuchEntryPoint:
# TODO Should be a error when all backends are migrated here
available_entrypoints = entrypoints.get_group_all(
ENTRYPOINT_GROUP_NAME)
available_plugins = [
entrypoint.name for entrypoint in available_entrypoints]
__logger__.warning("Backend '%s' is not available. Available plugins are %s",
backend_name, available_plugins + list(MLFLOW_BACKENDS.keys()))
return None
示例2: _get_entrypoints_lib
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def _get_entrypoints_lib(group, name=None):
import entrypoints
# Monkey patch some attributes for better API compatibility
entrypoints.EntryPoint.dist = property(lambda self: self.distro)
if name:
return entrypoints.get_single(group, name)
else:
from collections import OrderedDict
# Copied from 'get_group_named()' except that it preserves order
result = OrderedDict()
for ep in entrypoints.get_group_all(group):
if ep.name not in result:
result[ep.name] = ep
return result
示例3: _get_entry_points
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def _get_entry_points():
import importlib
class BasebandFormat:
def __init__(self, name, value):
self.name = name
self.value = value
def load(self):
return importlib.import_module(self.value)
def __repr__(self):
return f"BasebandFormat('{self.name}', '{self.value}')"
entries = {key: BasebandFormat(key, 'baseband.'+key) for key
in ('dada', 'guppi', 'mark4', 'mark5b', 'vdif', 'gsb')}
try:
from entrypoints import get_group_all
except ImportError:
try:
from pkg_resources import iter_entry_points as get_group_all
except ImportError:
return entries
for entry_point in get_group_all('baseband.io'):
entries.setdefault(entry_point.name, entry_point)
return entries
示例4: test_get_group_all
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def test_get_group_all():
group = entrypoints.get_group_all('entrypoints.test1', sample_path)
print(group)
assert len(group) == 5
assert {ep.name for ep in group} == {'abc', 'rew', 'opo', 'njn'}
示例5: names
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def names(self) -> List[str]:
"""List the names of the registered and entry points plugins."""
exts = list(self._plugins.keys())
more_exts = [
ep.name for ep in entrypoints.get_group_all(self.entry_point_group)
]
exts.extend(more_exts)
return sorted(set(exts))
示例6: before_start
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def before_start(self, checkers):
"""
Loads entry points named kibitzr.before_start
and call each one with two arguments:
1. Application instance;
2. List of configured checkers
"""
for point in entrypoints.get_group_all("kibitzr.before_start"):
entry = point.load()
entry(self, checkers)
示例7: load_extensions
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def load_extensions(self):
for point in entrypoints.get_group_all("kibitzr.creds"):
factory = point.load()
self.extensions[point.name] = factory()
示例8: load_extensions
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def load_extensions():
"""Return list of fetcher promoters defined in Kibitzr extensions"""
return [
point.load()
for point in entrypoints.get_group_all("kibitzr.fetcher")
]
示例9: load_extensions
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def load_extensions():
"""Return list of Kibitzr CLI extensions"""
return [
point.load()
for point in entrypoints.get_group_all("kibitzr.cli")
]
示例10: __init__
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def __init__(self):
super(PipelineProcessorRegistry, self).__init__()
# Register all known processors based on entrypoint configuration
for processor in entrypoints.get_group_all('elyra.pipeline.processors'):
try:
# instantiate an actual instance of the processor
processor_instance = processor.load()() # Load an instance
processor_type = processor_instance.type
self.log.info('Registering processor "{}" with type -> {}'.format(processor, processor_type))
self.__processors[processor_type] = processor_instance
except Exception:
# log and ignore initialization errors
self.log.error('Error registering processor "{}"'.format(processor))
示例11: register_entrypoints
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def register_entrypoints(self):
"""
Runs through all the packages that has the `group_name` defined as the entrypoint
and register that into the registry
"""
for entrypoint in entrypoints.get_group_all(self.group_name):
self.registry[entrypoint.name] = entrypoint
self._has_registered = True
示例12: register_entrypoints
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def register_entrypoints(self):
"""Register tracking stores provided by other packages"""
for entrypoint in entrypoints.get_group_all("mlflow.run_context_provider"):
try:
self.register(entrypoint.load())
except (AttributeError, ImportError) as exc:
warnings.warn(
'Failure attempting to register context provider "{}": {}'.format(
entrypoint.name, str(exc)
),
stacklevel=2
)
示例13: register_entrypoints
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def register_entrypoints(self):
"""Register tracking stores provided by other packages"""
for entrypoint in entrypoints.get_group_all(self.group_name):
try:
self.register(entrypoint.name, entrypoint.load())
except (AttributeError, ImportError) as exc:
warnings.warn(
'Failure attempting to register store for scheme "{}": {}'.format(
entrypoint.name, str(exc)
),
stacklevel=2
)
示例14: register_entrypoints
# 需要导入模块: import entrypoints [as 别名]
# 或者: from entrypoints import get_group_all [as 别名]
def register_entrypoints(self):
# Register artifact repositories provided by other packages
for entrypoint in entrypoints.get_group_all("mlflow.artifact_repository"):
try:
self.register(entrypoint.name, entrypoint.load())
except (AttributeError, ImportError) as exc:
warnings.warn(
'Failure attempting to register artifact repository for scheme "{}": {}'.format(
entrypoint.name, str(exc)
),
stacklevel=2
)