load_module

        Attempts to load module by name, if it is not available,
        loads it by url
435782
def load_module(self, module, module_uri=None):
        
        # Check to see that module isn't availble in python path
        try:
            import_module(module)
        except ImportError, e:
            if module_uri is None:
                raise e
        else:
            return module

        if not CACHE_DOWNLOADS:
            module_name = self._unique_module_name(module)
        else:
            module_name = self._sanitize_module_name(module)

        # Check to see whether we've already downloaded, otherwise, download
        try:
            import_module(module_name)
        except ImportError:
            module_file = self.download_module(module_uri)
            try:
                load_source(module_name, module_file)
            except Exception:
                msg = "Unable to load code module %s" % module
                self._log.exception(msg)
                raise PIDanticExecutionException(msg)

        return module_name
617976
def load_object_by_name(object_name):
    """"""
    mod_name, attr = object_name.rsplit('.', 1)
    mod = import_module(mod_name)
    return getattr(mod, attr)
768270
function require(name, jumped){
    if (cache[name]) return cache[name].exports;
    if (modules[name]) return call(name, require);
    throw new Error('cannot find module "' + name + '"');
  }
1345919
def load_from_cache(path=user_path):
    '''
    
    '''
    if not path:
        return
    try:
        with open(path, 'rb') as f:
            dversion, mversion, data = pickle.load(f)
        if dversion == data_version and mversion == module_version:
            return data
    except (FileNotFoundError, ValueError, EOFError):
        pass
101980
def load_module(self, module_name, pfx=None, path=None):
        """"""
        try:
            if pfx:
                name = pfx + '.' + module_name
            else:
                name = module_name

            if name in sys.modules:
                module = sys.modules[name]
                self.logger.info("Reloading module '%s'..." % module_name)
                module = importlib.reload(module)

            else:
                self.logger.info("Loading module '%s'..." % module_name)
                module = my_import(name, path=path)

            self.module[module_name] = module
            return module

        except Exception as e:
            self.logger.error("Failed to load module '%s': %s" % (
                module_name, str(e)))
            raise ModuleManagerError(e)
742675
function evaluateLoadedModule(loader, load) {
      console.assert(load.status == 'linked', 'is linked ' + load.name);

      doEnsureEvaluated(load.module, [], loader);
      return load.module.module;
    }
222428
def load_from_name(module_name):
    
    global _CONFIG_CACHE
    if module_name not in _CONFIG_CACHE:
        settings = OrderedDict()
        if isinstance(module_name, six.string_types):
            settings = _load_from_module(_import_module(module_name))
        _CONFIG_CACHE[module_name] = settings
    return _CONFIG_CACHE[module_name]
733719
def tryDynMod(name):
    '''
    
    '''
    try:
        return importlib.import_module(name)
    except ModuleNotFoundError:
        raise s_exc.NoSuchDyn(name=name)
638982
def load_class_by_name(name: str):
    """"""
    mod_path, _, cls_name = name.rpartition('.')
    mod = importlib.import_module(mod_path)
    cls = getattr(mod, cls_name)
    return cls
316521
protected function loadModule() : void
    {
        $fqn = $this->getFullyQualifiedClass($this->response->getModule(), $this->response->getController());
        $the_module = new $fqn();
        call_user_func_array(array($the_module, $this->getActionMethodName($this->response->getAction())), [$this->response->getVariables()]);
    }
843205
function moduleExists(name) {
  //TODO: Check that the file exists before trying to require it.
  try {
    require.resolve(name);
  }
  catch (err) {
    this.server.emit('error', err);
    return false;
  }
  return true;
}
96008
function loadModule(modulePath) {
    // Setup environment
    if (loadedModule === undefined || loadedModulePath != modulePath) {
        loadedModule = require(modulePath);
        loadedModulePath = modulePath;
        
        return Q(loadedModule);        
    } else {
        return Q(loadedModule);
    }
}
261676
def load_module(self, path, changed_time, parser=None):
        """"""
        if settings.use_filesystem_cache == False:
            return None
        
        try:
            pickle_changed_time = self._index[path]
        except KeyError:
            return None

        if (changed_time is not None and
            pickle_changed_time < changed_time):
            # the pickle file is outdated
            return None

        target_path = self._get_hashed_path(path)
        with open(target_path, 'rb') as f:
            try:
                gc.disable()
                cache_module = pickle.load(f)
                if parser is not None:
                    for mod in cache_module:
                        mod.unpickle(parser)
            finally:
                gc.enable()

        debug.dbg('pickle loaded: %s', path)
        return cache_module
389281
def load(target, source_module=None):
    """"""
    module, klass, function = _get_module(target)
    if not module and source_module:
        module = source_module
    if not module:
        raise MissingModule(
            "No module name supplied or source_module provided.")
    actual_module = sys.modules[module]
    if not klass:
        return getattr(actual_module, function)

    class_object = getattr(actual_module, klass)
    if function:
        return getattr(class_object, function)
    return class_object
1231806
def load_module(module_name, mib_dir=DEFAULT_MIB_PATH)
      oid_hash = nil
      File.open(MIB.module_file_name(module_name, mib_dir)) do |file|
        oid_hash = YAML.load(file.read)
      end
      @by_name.merge!(oid_hash) do |key, old, value|
        warn "warning: overwriting old MIB name '#{key}'"
      end
      @by_module_by_name[module_name] = {}
      @by_module_by_name[module_name].merge!(oid_hash)

      name_hash = Hash[ oid_hash.invert.to_a.collect { |oid, name| [oid, "#{module_name}::#{name}"] } ]
      @by_oid.merge!(name_hash)
    end
488775
function getModule(name, loader) {
    var exports;
    var entry = loader.defined[name];

    if (!entry) {
      exports = loader.get(name);
      if (!exports)
        throw new Error('Unable to load dependency ' + name + '.');
    }

    else {
      if (entry.declarative)
        ensureEvaluated(name, entry, [], loader);
    
      else if (!entry.evaluated)
        linkDynamicModule(entry, loader);

      exports = entry.module.exports;
    }

    if ((!entry || entry.declarative) && exports && exports.__useDefault)
      return exports['default'];
    
    return exports;
  }
423129
function(parentModule, id, callback) {

  // Try to load the module.
  return Promise.try(function() {
    return parentModule.require(id);
  })
  // Ignore module not found errors, and decorate all others.
  .catch(function(err) {
    if (err.code !== 'MODULE_NOT_FOUND') {
      throw new KboxRequireError(id, err);
    }
  })
  // Return.
  .nodeify(callback);

}