Ejemplo n.º 1
0
    def _initializeYapsy(self):
        # Build the manager
        self._yapsyPluginManager = PluginManager()
        self._yapsyPluginManager = FilteredPluginManager(
            self._yapsyPluginManager)
        self._yapsyPluginManager.isPluginOk = lambda x: x.name not in self._turnOffFeatures

        # Tell it the default place(s) where to find plugins
        self._yapsyPluginManager.setPluginPlaces(self._pluginPaths)
        # Define the various categories corresponding to the different
        # kinds of plugins you have defined
        self._yapsyPluginManager.setCategoriesFilter({
            "ObjectFeatureComputation":
            ObjectFeatureComputationPlugin,
            "TransitionFeatureVectorConstruction":
            TransitionFeatureVectorConstructionPlugin,
            "ImageProvider":
            ImageProviderPlugin,
            "FeatureSerializer":
            FeatureSerializerPlugin,
            "MergerResolver":
            MergerResolverPlugin,
        })
        if self._verbose:
            logging.getLogger('yapsy').setLevel(logging.DEBUG)
        else:
            logging.getLogger('yapsy').setLevel(logging.CRITICAL)

        self._yapsyPluginManager.collectPlugins()
Ejemplo n.º 2
0
    def setUp(self):
        """
		init
		"""
        # create the plugin manager
        #		print os.path.join(os.path.dirname(os.path.abspath(__file__)),"plugins")
        self.filteredPluginManager = FilteredPluginManager(
            directories_list=[
                os.path.join(os.path.dirname(os.path.abspath(__file__)),
                             "plugins")
            ],
            plugin_info_ext="yapsy-filter-plugin",
        )
        self.filteredPluginManager.isPluginOk = lambda info: not re.match(
            "^C", info.name)
        # load the plugins that may be found
        self.filteredPluginManager.collectPlugins()
        # Will be used later
        self.plugin_info = None
Ejemplo n.º 3
0
    def __init__(self):

        # Define the plugin categories and the associated class.
        # If we need to add a new plugin category, it must be done here.
        self.plugin_categories = {
            "worker": StoqWorkerPlugin,
            "connector": StoqConnectorPlugin,
            "reader": StoqReaderPlugin,
            "source": StoqSourcePlugin,
            "extractor": StoqExtractorPlugin,
            "carver": StoqCarverPlugin,
            "decoder": StoqDecoderPlugin
        }

        self.manager = PluginManager()
        self.manager.setPluginInfoExtension("stoq")
        self.manager.setPluginPlaces([self.plugin_dir])
        self.manager.setCategoriesFilter(self.plugin_categories)

        # Setup our plugin filter
        self.manager = FilteredPluginManager(self.manager)