MCPcopy Index your code
hub / github.com/USArmyResearchLab/Dshell / get_plugin_information

Function get_plugin_information

dshell/api.py:17–36  ·  view source on GitHub ↗

Generates and returns a dictionary of plugins. :return: dictionary containing plugin name -> plugin module :raises ImportError: If a plugin could not be imported.

()

Source from the content-addressed store, hash-verified

15
16# TODO: Should this be renamed to "load_plugins()" since it actually imports the modules?
17def get_plugin_information() -> dict:
18 """
19 Generates and returns a dictionary of plugins.
20 :return: dictionary containing plugin name -> plugin module
21 :raises ImportError: If a plugin could not be imported.
22 """
23 plugin_map = get_plugins()
24 # Import ALL of the decoders and print info about them before exiting
25 plugins = {}
26 for name, module in sorted(plugin_map.items(), key=operator.itemgetter(1)):
27 try:
28 module = import_module(module)
29 if not module.DshellPlugin:
30 continue
31 module = module.DshellPlugin()
32 plugins[name] = module
33 except Exception as e:
34 raise ImportError(f"Could not load {repr(module)} with error: {e}")
35
36 return plugins

Callers 1

main_command_lineFunction · 0.90

Calls 1

get_pluginsFunction · 0.85

Tested by

no test coverage detected