class core.plugin.instance.PluginInstanceManager(manager, plugins=None, proxy_class=None)[source]

Bases: object

clear()[source]
function(group, name)[source]
has_instance(group, name)[source]
implementations(interface, **kwds)[source]

Return all instances implementing this interface

instance(group, name, class_args=None, class_kwds=None)[source]

Use this function if you always want the same instance: If plugin has never been called, create a new instance else return first created one.

instances(group, name=None, class_args=None, class_kwds=None)[source]

Return all existing instances corresponding to this plugin

new(group, name, class_args=None, class_kwds=None)[source]

Create a new instance and register it. You can get all created instances with instances method.

register(group, name, instance)[source]

Add a weakref to instance in dict group -> name -> [list of instances]

set_manager(manager)[source]
unregister(group, name, instance)[source]

Unregistered instances won't be list by "instances" method

debug[source]
core.plugin.instance.enhanced_error(error, **kwds)[source]

Add plugin information to given exception. By default, if a plugin fails, for example because a dependency cannot be imported, user get error message "ImportError: No module named mydep". This message is useless because we don't know which plugin has failed.

Once enhanced, error message become: "MyLab (mypackage.lab.mylab): ImportError: No module named mydep"

kwds:

  • plugin: plugin instance
  • plugin_class: plugin class

Previous topic

<no title>

Next topic

interface plugin documentation

This Page