forked from TrueCloudLab/frostfs-testlib
Rename neofs to frostfs
Signed-off-by: Yulia Kovshova <y.kovshova@yadro.com>
This commit is contained in:
parent
5a2c7ac98d
commit
6d3b6f0f2f
83 changed files with 330 additions and 338 deletions
25
src/frostfs_testlib/plugins/__init__.py
Normal file
25
src/frostfs_testlib/plugins/__init__.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import sys
|
||||
from typing import Any
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
# On Python prior 3.10 we need to use backport of entry points
|
||||
from importlib_metadata import entry_points
|
||||
else:
|
||||
from importlib.metadata import entry_points
|
||||
|
||||
|
||||
def load_plugin(plugin_group: str, name: str) -> Any:
|
||||
"""Loads plugin using entry point specification.
|
||||
|
||||
Args:
|
||||
plugin_group: Name of plugin group that contains the plugin.
|
||||
name: Name of the plugin in the group.
|
||||
|
||||
Returns:
|
||||
Plugin class if the plugin was found; otherwise returns None.
|
||||
"""
|
||||
plugins = entry_points(group=plugin_group)
|
||||
if name not in plugins.names:
|
||||
return None
|
||||
plugin = plugins[name]
|
||||
return plugin.load()
|
Loading…
Add table
Add a link
Reference in a new issue