MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / get_plugins

Function get_plugins

src/plugins/plugin.py:6–29  ·  view source on GitHub ↗

Iterate through plugins (`connect_plugin` attribute of entry point) which name starts with `point` or equals to `name`. If `fallback` kwarg specified, plugin with that name yield last.

(group, point='', name=None, fallback=None)

Source from the content-addressed store, hash-verified

4
5
6def get_plugins(group, point='', name=None, fallback=None):
7 """
8 Iterate through plugins (`connect_plugin` attribute of entry point)
9 which name starts with `point` or equals to `name`.
10 If `fallback` kwarg specified, plugin with that name yield last.
11 """
12 for ep in pkg_resources.iter_entry_points('bitmessage.' + group):
13 if name and ep.name == name or ep.name.startswith(point):
14 try:
15 plugin = ep.load().connect_plugin
16 if ep.name == fallback:
17 _fallback = plugin
18 else:
19 yield plugin
20 except (AttributeError,
21 ImportError,
22 ValueError,
23 pkg_resources.DistributionNotFound,
24 pkg_resources.UnknownExtra):
25 continue
26 try:
27 yield _fallback
28 except NameError:
29 pass
30
31
32def get_plugin(*args, **kwargs):

Callers 2

get_pluginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected