Api Reference¶
HookimplMarker¶
-
class
HookimplMarker(project_name, flags=None)[source]¶ Bases:
objectDecorator helper class for marking functions as hook implementations.
You can instantiate with a project_name to get a decorator. Calling PluginManager.register later will discover all marked functions if the PluginManager uses the same project_name.
HookspecMarker¶
-
class
HookspecMarker(project_name, flags=None)[source]¶ Bases:
objectDecorator helper class for marking functions as hook specifications.
You can instantiate it with a project_name to get a decorator. Calling PluginManager.register_specs later will discover all marked functions if the PluginManager uses the same project_name.
PluginManager¶
-
class
PluginManager(project_name)[source]¶ Bases:
objectCore Pluginmanager class which manages registration of plugin objects and 1:N hook calling.
You can register new hooks by calling
add_hookspec(module_or_class). You can register plugin objects (which contain hooks) by callingregister(plugin). The Pluginmanager is initialized with a prefix that is searched for in the names of the dict of registered plugin objects.For debugging purposes you can call
enable_tracing()which will subsequently send debug information to the trace helper.-
register(namespace)[source]¶ Register a plugin and return its canonical name.
Raises: ValueError– if the plugin is already registered.
-
register_specs(namespace)[source]¶ add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly.
-
unhandled_exceptions= None¶ type: list(tuple(aiopluggy.hooks.HookImpl, Exception))
-
unscheduled_coros= None¶ type: list(tuple(aiopluggy.hooks.HookImpl, Coroutine))
-
Result¶
-
class
Result(value=None, exc_info=None)[source]¶ Bases:
object-
exc_info¶ Exception info.
Return type: a tuple. See sys.exc_info()for details.
-
exception¶ Exception info.
Return type: a tuple. See sys.exc_info()for details.
-
value¶ Get the result(s) for this hook call.
If the hook was marked as a first_notnone or first_only only a single value will be returned otherwise a list of results.
-