Anonymous avatar Anonymous committed d450a6a Draft

tolerate attempt to remove non-existing instance; added doc strings; pylint

Comments (0)

Files changed (1)

araldo/plugins.py

         self.instantiate_plugins()
 
     def gevent_queue(self):
+        """ Global internal event queue which is used to keep all
+            incoming messages before they get dispatched to
+            outbound endpoints
+        """
         return self._gevent_queue
 
     def plugin_instances(self):
+        """ Currently instantiated plugin objects
+        """
         return self._plugin_instances
 
     def add_plugin_instance(
             plugin_group_key,
             plugin_name,
             plugin_instance):
+        """ Add a single plugin instance
+        """
         self._log.debug(
             "Adding plugin instance for group=%s, name=%s",
             plugin_group_key, plugin_name)
             self,
             plugin_group_key,
             plugin_name):
+        """ Removes the plugin identified by group/name if it exists
+        """
         self._log.debug(
             "Removing plugin instance for group=%s, name=%s",
             plugin_group_key, plugin_name)
-        del self._plugin_instances[plugin_group_key][plugin_name]
+        container = self._plugin_instances[plugin_group_key]
+        if plugin_name in container:
+            del container[plugin_name]
 
     def _load_plugins_for_group(self, group, class_name):
         """ Load plugins for a particular group
             try:
                 #end_point.check()
                 pass
-            except Exception as e:
-                self._log.error("\tloading failed: %s", str(e))
+            except Exception as error:
+                self._log.error("\tloading failed: %s", error)
 
     def load_plugins(self):
         """ Load araldo plugins
         return plugin_instance
 
     def instantiate_plugins(self):
+        """ Instantiate available plugins based on configuration.
+            The configuration file lists instances with their *unique*
+            names and plugin configuration
+        """
         self._log.debug("Instantiating plugins")
         self.load_plugins()
         self._plugin_instances = defaultdict(lambda: {})
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.