Defines the basic mechanisms to have a plugin manager filter the available list of plugins after locating them and before loading them.
One use fo this would be to prevent untrusted plugins from entering the system.
To use it properly you must reimplement or monkey patch the IsPluginOk method, as in the following example:
# define a plugin manager (with you prefered options) pm = PluginManager(...) # decorate it with the Filtering mechanics pm = FilteredPluginManager(pm) # define a custom predicate that filters out plugins without descriptions pm.isPluginOk = lambda x: x.description!=""
Base class for decorators which filter the plugins list before they are loaded.
Add a new candidate.
Go through the currently available candidates, and and either leaves them, or moves them into the list of rejected Plugins.
Can be overridden if overriding isPluginOk sentinel is not powerful enough.
Return the list of rejected plugins.
Sentinel function to detect if a plugin should be filtered.
info is an instance of a PluginInfo and this method is expected to return True if the corresponding plugin can be accepted, and False if it must be filtered out.
Subclasses should override this function and return false for any plugin which they do not want to be loadable.
locate and filter plugins.
Move a plugin from the candidates list to the rejected List.
Remove a plugin from the list of candidates.
Move a plugin from the rejected list to into the candidates list.