Import and load application modules.

        :return: <dict>
198884
def _getModules(self):
        
        modules = {}
        modulesPath = os.path.join("application", "module")
        moduleList = os.listdir(modulesPath)

        for moduleName in moduleList:
            modulePath = os.path.join(modulesPath, moduleName, "module.py")
            if not os.path.isfile(modulePath):
                continue

            # importing module
            moduleSpec = importlib.util.spec_from_file_location(
                moduleName,
                modulePath
            )
            module = importlib.util.module_from_spec(moduleSpec)
            moduleSpec.loader.exec_module(module)

            # initializing module
            moduleInstance = module.Module(self)
            modules[moduleName] = moduleInstance

        return modules
575107
def load(self):
        """"""
        if self._modules_loaded is True:
            return

        self.load_modules_from_python(routes.ALL_ROUTES)
        self.aliases.update(routes.ALL_ALIASES)
        self._load_modules_from_entry_points('softlayer.cli')

        self._modules_loaded = True
1293465
def load():
    
    config = ConfigParser.RawConfigParser(DEFAULTS)
    config.readfp(open(CONF_PATH))
    for section in config.sections():
        globals()[section] = {}
        for key, val in config.items(section):
            globals()[section][key] = val
710409
def load_modules(self, args):
        """"""

        # Init the plugins dict
        # Active plugins dictionnary
        self._plugins = collections.defaultdict(dict)
        # Load the plugins
        self.load_plugins(args=args)

        # Init the export modules dict
        # Active exporters dictionnary
        self._exports = collections.defaultdict(dict)
        # All available exporters dictionnary
        self._exports_all = collections.defaultdict(dict)
        # Load the export modules
        self.load_exports(args=args)

        # Restoring system path
        sys.path = sys_path
1239224
def get_app_model_classes(self):
        
        models = []
        for m in self.models:
            mod, cls = m.rsplit('.', 1)
            mod = import_module(mod)
            models.append(getattr(mod, cls))
        return models
510714
def load_module(self, name):
        
        self.loaded_modules.append(name)

        try:
            __import__(name, {}, {}, [])

            mod = sys.modules[name]
            self._run_hooks(name, mod)
        except:
            self.loaded_modules.pop()

            raise

        return mod
29555
def load_modules_from_python(self, route_list):
        """"""
        for name, modpath in route_list:
            if ':' in modpath:
                path, attr = modpath.split(':', 1)
            else:
                path, attr = modpath, None
            self.commands[name] = ModuleLoader(path, attr=attr)
1068655
def load_settings(self):
        """"""
        mname = 'loaded_module'
        if six.PY2:
            import imp
            return imp.load_source(mname, self.settings_filename)
        else:
            import importlib.machinery
            loader = importlib.machinery.SourceFileLoader(mname, self.settings_filename)
        return loader.load_module(mname)
471532
def get_modules():
    '''
    
    '''
    modules = []
    module_list = exec_action('modules', 'list', action_parameter='--only-names')
    if not module_list:
        return None

    for module in module_list:
        if module not in ['help', 'usage', 'version']:
            modules.append(module)
    return modules
1259557
def load_module(self, name):
        """"""
        if name in sys.modules:
            return sys.modules[name]
        # load the actual import hook module
        module_name = self.mount2name(name)
        __import__(module_name)
        # alias the import hook module to the mount, so both can be used interchangeably
        module = sys.modules[name] = sys.modules[module_name]
        module.install()
        return module
121410
def import_event_modules():
    
    for installed_app in getsetting('INSTALLED_APPS'):
        module_name = u'{}.{}'.format(installed_app, EVENTS_MODULE_NAME)
        try:
            import_module(module_name)
        except ImportError:
            pass
200170
def _get_dependencies(self):
        
        #The only complication with the whole process is that we need to get the list of
        #dependencies for the current module. For full lib, we compile *all* the files in
        #the directory, otherwise only those that are explicitly required.
        from os import path
        modules = self.module.search_dependencies()
        result = {}
        for module in modules:
            self.module.parent.load_dependency(module, True, True, False)
            
        for modname, module in list(self.module.parent.modules.items()):
            pathkey = path.dirname(module.filepath).lower()
            if pathkey not in result:
                result[pathkey] = path.dirname(module.filepath)

        return result
13896
def load_modules(self, modules, config):
        """"""
        for pluginclass in get_plugin_classes(modules):
            name = pluginclass.__name__
            if name in config["enabledplugins"]:
                if issubclass(pluginclass, _ConnectionPlugin):
                    log.debug(LOG_PLUGIN, "Enable connection plugin %s", name)
                    self.connection_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ContentPlugin):
                    log.debug(LOG_PLUGIN, "Enable content plugin %s", name)
                    self.content_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ParserPlugin):
                    log.debug(LOG_PLUGIN, "Enable parser plugin %s", name)
                    self.parser_plugins.append(pluginclass(config[name]))
                else:
                    raise ValueError("Invalid plugin class %s" % pluginclass)
840963
def get_app_modules(self, apps):
        
        modules = getattr(self, "_modules", [])

        if not modules:
            from django.utils.module_loading import module_has_submodule

            # Try importing a modules from the module package
            package_string = '.'.join(['leonardo', 'module'])

            for app in apps:
                exc = '...'
                try:
                    # check if is not full app
                    _app = import_module(app)
                except Exception as e:
                    _app = False
                    exc = e

                if module_has_submodule(
                        import_module(package_string), app) or _app:
                    if _app:
                        mod = _app
                    else:
                        mod = import_module('.{0}'.format(app), package_string)
                    if mod:
                        modules.append(mod)
                        continue

                warnings.warn('%s was skipped because %s ' % (app, exc))

            self._modules = modules
        return self._modules
1029723
def load_all_resources():
    
    pkgname = resources.__name__
    for importer, mod_name, _ in pkgutil.iter_modules(resources.__path__):
        full_mod_name = '%s.%s' % (pkgname, mod_name)
        if full_mod_name not in sys.modules:
            module = importer.find_module(mod_name
                        ).load_module(full_mod_name)
            log.debug("Loaded resource from: %s", module)
1209421
def celery_module_imports(sender, signal=None, **kwargs):
    """"""
    app = getattr(sender, 'flask_app', None)
    if app:
        app.extensions['invenio-celery'].load_entry_points()
17795
def __push_import_modules(self):
        
        for module in self.__import_modules:
            sys.modules[module.__name__] = module