Load all modules found in a namespace
196974
def _fill_cache(self, namespace):
        """"""

        modules = self._findPluginModules(namespace)

        self._cache = list(modules)
187733
def _load_config(initial_namespace=None, defaults=None):
    # type: (Optional[str], Optional[str]) -> ConfigLoader
    
    # load defaults
    if defaults:
        config = ConfigLoader()
        config.update_from_object(defaults)

    namespace = getattr(config, 'CONFIG_NAMESPACE', initial_namespace)
    app_config = getattr(config, 'APP_CONFIG', None)

    # load customised config
    if app_config:
        if namespace is None:
            config.update_from_object(app_config)
        else:
            _temp = ConfigLoader()
            _temp.update_from_object(app_config, lambda key: key.startswith(namespace))
            config.update(_temp.namespace(namespace))

    return config
676159
def import_modules(names, src, dst):
    """"""
    for name in names:
        module = importlib.import_module(src + '.' + name)
        setattr(sys.modules[dst], name, module)
587391
def get_all_importing_namespace_hashes( self ):
        
        cur = self.db.cursor()
        namespace_hashes = namedb_get_all_importing_namespace_hashes( cur, self.lastblock )
        return namespace_hashes
213353
def load_module(self, name):
        
        # allow reload noop
        if name in sys.modules:
            return sys.modules[name]
        raise DisabledIncludeError('Include type %r disabled, cannot import module %r' % (self._module_prefix, name))
597485
def load_classes(package_str):
    ''''''

    _logger.debug('Loading all modules from %s', package_str)
    package = importlib.import_module(package_str)
    package_path = package.__path__
    _logger.debug('Searching for modules in package %s (%s)', package_str, package_path)
    for _, name, ispkg in pkgutil.iter_modules(package_path, package_str + "."):
        if not ispkg:
            _logger.debug('Found module: %s', name)
            module = importlib.import_module(name)
            if hasattr(module, CLASS_NAME_ATTR):
                class_name = getattr(module, CLASS_NAME_ATTR)
                _logger.debug('Found class: %s', class_name)
                clasz = getattr(module, class_name)

                if package_str not in _dynamo_cache:
                    _dynamo_cache[package_str] = CaseInsensitiveDict()
                
                if class_name not in _dynamo_cache[package_str]:
                    _dynamo_cache[package_str][class_name] = clasz
                    _logger.debug('Correctly loaded class: %s from: "%s"', class_name, package_str)
                else:
                    _logger.warning('Already loaded class: %s from: "%s"', class_name, package_str)
            else:
                _logger.warning('Module inside %s does not contain required attribute: %s', package_str, CLASS_NAME_ATTR)
        else:
            _logger.warning('Ignoring package: %s', name)

    if package_str in _dynamo_cache:
        return _dynamo_cache[package_str]
    else:
        return None
249070
def get_introspection_module(namespace):
    """"""

    if namespace in _introspection_modules:
        return _introspection_modules[namespace]

    from . import get_required_version

    repository = GIRepository()
    version = get_required_version(namespace)

    try:
        repository.require(namespace, version, 0)
    except GIError as e:
        raise ImportError(e.message)

    # No strictly needed here, but most things will fail during use
    library = repository.get_shared_library(namespace)
    if library:
        library = library.split(",")[0]
        try:
            util.load_ctypes_library(library)
        except OSError:
            raise ImportError(
                "Couldn't load shared library %r" % library)

    # Generate bindings, set up lazy attributes
    instance = Module(repository, namespace)
    instance.__path__ = repository.get_typelib_path(namespace)
    instance.__package__ = const.PREFIX[0]
    instance.__file__ = "<%s.%s>" % (const.PREFIX[0], namespace)
    instance._version = version or repository.get_version(namespace)

    _introspection_modules[namespace] = instance

    return instance
444516
def load_plugins_from_module(module_name):
    
    plugins = {}

    try:
        if module_name.endswith('.py'):
            import imp
            mod = imp.load_source('module.name', module_name)
        else:
            mod = importlib.import_module(module_name)
    except Exception as e:
        logger.debug("Import module <{}> failed: {}".format(module_name, e))
        return {}
    for _, cls in inspect.getmembers(mod, inspect.isclass):
        # Don't try to register plugins imported into this module elsewhere
        if issubclass(cls, (Catalog, DataSource)):
            plugins[cls.name] = cls

    return plugins
852522
def get_loaded_modules(modules):
    ''''''

    _modules = []
    for mod in modules:
        mod_cfg = get_conf_from_module(mod)

        _modules.append((mod, mod_cfg,))

    _modules = sorted(_modules, key=lambda m: m[1].get('ordering'))

    return _modules
1255346
function loadModules() {
  const nodeModulesPath = path.join(process.cwd(), plugin.config.modulesPath);

  return plugin.myrmex.fire('beforeNodeModulesLoad')
  .then(() => {
    // Retrieve paths of all node packages
    return Promise.promisify(fs.readdir)(nodeModulesPath);
  })
  .then(subdirs => {
    // Load all packages configurations
    const nodeModulePromises = [];
    _.forEach(subdirs, (subdir) => {
      const nodeModulePath = path.join(nodeModulesPath, subdir);
      // subdir is the name of the package, so we pass it as the second argument
      nodeModulePromises.push(loadNodeModule(nodeModulePath, subdir));
    });
    return Promise.all(nodeModulePromises);
  })
  .then(nodeModules => {
    // This event allows to inject code to add or delete or alter node modules configurations
    return plugin.myrmex.fire('afterNodeModulesLoad', nodeModules);
  })
  .spread(nodeModules => {
    return Promise.resolve(nodeModules);
  })
  .catch(e => {
    // In case the project does not have any node package yet, an exception will be thrown
    // We silently ignore it
    if (e.code === 'ENOENT' && path.basename(e.path) === 'modules') {
      return Promise.resolve([]);
    }
    return Promise.reject(e);
  });
}
679789
def get_namespace(self):
        
        if 'holoviews' not in sys.modules:
            raise ImportError('HoloViews does not seem to be imported')
        matches = [k for k,v in get_ipython().user_ns.items() # noqa (get_ipython)
           if not k.startswith('_') and v is sys.modules['holoviews']]
        if len(matches) == 0:
            raise Exception("Could not find holoviews module in namespace")
        return '%s.archive' % matches[0]
813006
def _load_all(self):
        '''
        
        '''
        with self._lock:
            for name in self.file_mapping:
                if name in self.loaded_files or name in self.missing_modules:
                    continue
                self._load_module(name)

            self.loaded = True
1274570
def load_modules(self):
        """"""
        if self.INTERFACES_MODULE is None:
            raise NotImplementedError("A module containing interfaces modules "
                                      "should be setup in INTERFACES_MODULE !")
        else:
            for module, permission in self.modules.items():
                i = getattr(self.INTERFACES_MODULE,
                            module).Interface(self, permission)
                self.interfaces[module] = i
157151
def unified_load(namespace, subclasses=None, recurse=False):
    

    if subclasses is not None:
        return ClassLoader(recurse=recurse).load(namespace, subclasses=subclasses)
    else:
        return ModuleLoader(recurse=recurse).load(namespace)
342010
function loadUses() {
          var globs = Array.prototype.slice.call(arguments, 0);
          var path = require('path');
          utils.forEach(globs, function(patt) {
            var files = glob.sync(patt, {});
            utils.forEach(files, function(file) {
              require(path.join(process.cwd(), file));
            });
          });

          return moduleInstance;
        }
1120499
def collect_namespaces(metadata):
    # type: (Mapping[Text, Any]) -> Dict[Text, Text]
    """"""
    namespaces = {}  # type: Dict[Text, Text]
    if "$import_metadata" in metadata:
        for value in metadata["$import_metadata"].values():
            add_namespaces(collect_namespaces(value), namespaces)
    if "$namespaces" in metadata:
        add_namespaces(metadata["$namespaces"], namespaces)
    return namespaces
624790
def bind_all_namespaces(self):
        '''
            

        '''
        for prefix in self.curie_map.keys():
            iri = self.curie_map[prefix]
            self.bind(prefix, Namespace(iri))
        return