def load_modules(self, filepaths):
        """
        Loads the modules from their `filepaths`. A filepath may be
        a directory filepath if there is an `__init__.py` file in the
        directory.

        If a filepath errors, the exception will be caught and logged
        in the logger.

        Returns a list of modules.
        """
        # removes filepaths from processed if they are not in sys.modules
        self._update_loaded_modules()
        filepaths = util.return_set(filepaths)

        modules = []
        for filepath in filepaths:
            filepath = self._clean_filepath(filepath)
            # check to see if already processed and move onto next if so
            if self._processed_filepath(filepath):
                continue

            module_name = util.get_module_name(filepath)
            plugin_module_name = util.create_unique_module_name(module_name)

            try:
                module = load_source(plugin_module_name, filepath)
            # Catch all exceptions b/c loader will return errors
            # within the code itself, such as Syntax, NameErrors, etc.
            except Exception:
                exc_info = sys.exc_info()
                self._log.error(msg=self._error_string.format(filepath),
                                exc_info=exc_info)
                continue

            self.loaded_modules.add(module.__name__)
            modules.append(module)
            self.processed_filepaths[module.__name__] = filepath

        return modules
def load_modules ( self , filepaths ) : self . _update_loaded_modules ( ) filepaths = util . return_set ( filepaths ) modules = [ ] for filepath in filepaths : filepath = self . _clean_filepath ( filepath ) if self . _processed_filepath ( filepath ) : continue module_name = util . get_module_name ( filepath ) plugin_module_name = util . create_unique_module_name ( module_name ) try : module = load_source ( plugin_module_name , filepath ) except Exception : exc_info = sys . exc_info ( ) self . _log . error ( msg = self . _error_string . format ( filepath ) , exc_info = exc_info ) continue self . loaded_modules . add ( module . __name__ ) modules . append ( module ) self . processed_filepaths [ module . __name__ ] = filepath return modules
Loads the modules from their `filepaths`. A filepath may be
        a directory filepath if there is an `__init__.py` file in the
        directory.

        If a filepath errors, the exception will be caught and logged
        in the logger.

        Returns a list of modules.