Resolve a BasePluginLoaderRegistry instance from spec, and update
    spec[CALMJS_LOADERPLUGIN_REGISTRY] with that value before returning
    it.
165236
def spec_update_loaderplugin_registry(spec, default=None):
    

    registry = spec.get(CALMJS_LOADERPLUGIN_REGISTRY)
    if isinstance(registry, BaseLoaderPluginRegistry):
        logger.debug(
            "loaderplugin registry '%s' already assigned to spec",
            registry.registry_name)
        return registry
    elif not registry:
        # resolving registry
        registry = get_registry(spec.get(CALMJS_LOADERPLUGIN_REGISTRY_NAME))
        if isinstance(registry, BaseLoaderPluginRegistry):
            logger.info(
                "using loaderplugin registry '%s'", registry.registry_name)
            spec[CALMJS_LOADERPLUGIN_REGISTRY] = registry
            return registry

    # acquire the real default instance, if possible.
    if not isinstance(default, BaseLoaderPluginRegistry):
        default = get_registry(default)
        if not isinstance(default, BaseLoaderPluginRegistry):
            logger.info(
                "provided default is not a valid loaderplugin registry")
            default = None

    if default is None:
        default = BaseLoaderPluginRegistry('<default_loaderplugins>')

    # TODO determine the best way to optionally warn about this for
    # toolchains that require this.
    if registry:
        logger.info(
            "object referenced in spec is not a valid loaderplugin registry; "
            "using default loaderplugin registry '%s'", default.registry_name)
    else:
        logger.info(
            "no loaderplugin registry referenced in spec; "
            "using default loaderplugin registry '%s'", default.registry_name)
    spec[CALMJS_LOADERPLUGIN_REGISTRY] = registry = default

    return registry
418276
function Container(parent) {
      this.parent = parent;
      this.children = [];

      this.resolver = parent && parent.resolver || function() {};

      this.registry       = dictionary(parent ? parent.registry : null);
      this.cache          = dictionary(parent ? parent.cache : null);
      this.factoryCache   = dictionary(parent ? parent.factoryCache : null);
      this.resolveCache   = dictionary(parent ? parent.resolveCache : null);
      this.typeInjections = dictionary(parent ? parent.typeInjections : null);
      this.injections     = dictionary(null);
      this.normalizeCache = dictionary(null);

      this.factoryTypeInjections = dictionary(parent ? parent.factoryTypeInjections : null);
      this.factoryInjections     = dictionary(null);

      this._options     = dictionary(parent ? parent._options : null);
      this._typeOptions = dictionary(parent ? parent._typeOptions : null);
    }
1252161
def resolve_to_callable(callable_name):
    
    from . import registry
    clean_callable_name = callable_name.replace(
        '{{', '').replace('}}', '').strip()
    try:
        return registry.get(clean_callable_name)
    except KeyError:
        try:
            from zope.dottedname.resolve import resolve
            return resolve(clean_callable_name)
        except ImportError:
            raise ImportError(
                'Failed to load callable `{}`'.format(clean_callable_name))
1358063
def _resolve_base_image(self, build_json):
        """"""
        spec = build_json.get("spec")
        try:
            image_id = spec['triggeredBy'][0]['imageChangeBuild']['imageID']
        except (TypeError, KeyError, IndexError):
            # build not marked for auto-rebuilds; use regular base image
            base_image = self.workflow.builder.base_image
            self.log.info("using %s as base image.", base_image)
        else:
            # build has auto-rebuilds enabled
            self.log.info("using %s from build spec[triggeredBy] as base image.", image_id)
            base_image = ImageName.parse(image_id)  # any exceptions will propagate

        return base_image
1298940
def register_plugin(self, plugin: Plugin):
        
        if isinstance(plugin, Plugin):
            lazy = False
        elif issubclass(plugin, Plugin):
            lazy = True
        else:
            msg = 'plugin %r must be an object/class of type Plugin' % plugin
            raise DiayException(msg)

        predicate = inspect.isfunction if lazy else inspect.ismethod
        methods = inspect.getmembers(plugin, predicate=predicate)
        for _, method in methods:
            if getattr(method, '__di__', {}).get('provides'):
                if lazy:
                    self.register_lazy_provider_method(plugin, method)
                else:
                    self.register_provider(method)
435469
function resolve (moduleName, callback) {
                logger.trace('resolving: ' + moduleName);

                if (is.regexp(moduleName)) {
                    var modules = resolveTasks.filterMatchingRegistrations(moduleName, context)
                        .map(function (moduleNameText) {
                            return resolveOne(moduleNameText, moduleNameText);
                        })

                    if (is.function(callback)) {
                        callback(null, modules);
                    } else {
                        return modules;
                    }
                }

                return resolveOne(moduleName, moduleName, callback);
            }
1365442
function Builder(baseURL, cfg) {
  if (typeof baseURL == 'object') {
    cfg = baseURL;
    baseURL = null;
  }

  this.loader = null;
  this.resetConfig = function() {};

  this.reset();

  if (baseURL)
    this.config({ baseURL: baseURL });

  // config passed to constructor will
  // be saved for future .reset() calls
  if (typeof cfg == 'object')
    this.config(cfg, true, !!baseURL);
  else if (typeof cfg == 'string')
    this.loadConfigSync(cfg, true, !!baseURL);
}
281525
def on_resolve(target, func, *args, **kwargs):
    
    return _register_hook(ON_RESOLVE, target, func, *args, **kwargs)
878850
def LoadPlugins(cls):
        """"""

        if cls.PLUGINS_LOADED:
            return

        reg = ComponentRegistry()
        for _, record in reg.load_extensions('iotile.update_record'):
            cls.RegisterRecordType(record)

        cls.PLUGINS_LOADED = True
299523
function npmResolverPlugin() {
  return {
    resolve(filename, source /*, options */) {
      return resolve.sync(filename, { basedir: path.dirname(source) });
    }
  };
}
598522
private void loadDelayedPlugins() {
        while (!delayedLoadPlugins.isEmpty()) {
            GrailsPlugin plugin = delayedLoadPlugins.remove(0);
            if (areDependenciesResolved(plugin)) {
                if (!hasValidPluginsToLoadBefore(plugin)) {
                    registerPlugin(plugin);
                }
                else {
                    delayedLoadPlugins.add(plugin);
                }
            }
            else {
                // ok, it still hasn't resolved the dependency after the initial
                // load of all plugins. All hope is not lost, however, so lets first
                // look inside the remaining delayed loads before giving up
                boolean foundInDelayed = false;
                for (GrailsPlugin remainingPlugin : delayedLoadPlugins) {
                    if (isDependentOn(plugin, remainingPlugin)) {
                        foundInDelayed = true;
                        break;
                    }
                }
                if (foundInDelayed) {
                    delayedLoadPlugins.add(plugin);
                }
                else {
                    failedPlugins.put(plugin.getName(), plugin);
                    LOG.error("ERROR: Plugin [" + plugin.getName() + "] cannot be loaded because its dependencies [" +
                            DefaultGroovyMethods.inspect(plugin.getDependencyNames()) + "] cannot be resolved");
                }
            }
        }
    }
1339823
function possiblyFetch(id, plugins_dir, options) {
    var parsedSpec = pluginSpec.parse(id);
    //Check if a mapping exists for the plugin id
    //if it does, convert id to new name id
    var newId = parsedSpec.scope ? null : pluginMapper.oldToNew[parsedSpec.id];
    if(newId) {
        if(parsedSpec.version) {
            id = newId + '@' + parsedSpec.version;
        } else {
            id = newId;
        }
    }

    // if plugin is a relative path, check if it already exists
    var plugin_src_dir = isAbsolutePath(id) ? id : path.join(plugins_dir, parsedSpec.id);

    // Check that the plugin has already been fetched.
    if (fs.existsSync(plugin_src_dir)) {
        return Q(plugin_src_dir);
    }

    var alias =  parsedSpec.scope ? null : pluginMapper.newToOld[parsedSpec.id] || newId;
    // if the plugin alias has already been fetched, use it.
    if (alias && fs.existsSync(path.join(plugins_dir, alias))) {
        events.emit('warn', 'Plugin with alternate id ' + alias + ' is already fetched, so installing it instead of ' + parsedSpec.id);
        return Q(path.join(plugins_dir, alias));
    }

    // if plugin doesnt exist, use fetch to get it.
    if (newId) {
        events.emit('warn', 'Notice: ' + parsedSpec.id + ' has been automatically converted to ' + newId + ' and fetched from npm. This is due to our old plugins registry shutting down.');
    }
    var opts = underscore.extend({}, options, {
        client: 'plugman'
    });

    return plugman.raw.fetch(id, plugins_dir, opts);
}
293039
public synchronized void addCompilerPlugin(ScriptCompilerPluginSpec pluginSpec) throws ModuleLoadException  {
        Objects.requireNonNull(pluginSpec, "pluginSpec");
        ModuleIdentifier pluginModuleId = JBossModuleUtils.getPluginModuleId(pluginSpec);
        ModuleSpec.Builder moduleSpecBuilder = ModuleSpec.build(pluginModuleId);
        Map<ModuleId, ModuleIdentifier> latestRevisionIds = jbossModuleLoader.getLatestRevisionIds();
        JBossModuleUtils.populateCompilerModuleSpec(moduleSpecBuilder, pluginSpec, latestRevisionIds);
        // Add app package dependencies, while blocking them from leaking (being exported) to downstream modules
        // TODO: We expose the full set of app packages to the compiler too.
        // Maybe more control over what is exposed is needed here.
        JBossModuleUtils.populateModuleSpecWithAppImports(moduleSpecBuilder, appClassLoader, appPackagePaths);
        ModuleSpec moduleSpec = moduleSpecBuilder.create();

        // spin up the module, and get the compiled classes from it's classloader
        String providerClassName = pluginSpec.getPluginClassName();
        if (providerClassName != null) {
            jbossModuleLoader.addModuleSpec(moduleSpec);
            Module pluginModule = jbossModuleLoader.loadModule(pluginModuleId);
            ModuleClassLoader pluginClassLoader = pluginModule.getClassLoader();
            Class<?> compilerProviderClass;
            try {
                compilerProviderClass = pluginClassLoader.loadClass(providerClassName);
                ScriptCompilerPlugin pluginBootstrap = (ScriptCompilerPlugin) compilerProviderClass.newInstance();
                Set<? extends ScriptArchiveCompiler> pluginCompilers = pluginBootstrap.getCompilers(pluginSpec.getCompilerParams());
                compilers.addAll(pluginCompilers);
            } catch (Exception e) {
                throw new ModuleLoadException(e);
            }

            // Save classloader away, in case clients would like access to compiler plugin's classes.
            compilerClassLoaders.put(pluginSpec.getPluginId(), pluginModule.getClassLoader());
        }
    }
129785
def load_constant(constant)
      return if loaded?(constant)

      registry.load(constant)

      return unless registry.include?(constant)

      apply(constant)
    end
1036600
function normalizeRouteConfig(config, registry) {
    if (config instanceof route_config_decorator_1.AsyncRoute) {
        var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
        return new route_config_decorator_1.AsyncRoute({
            path: config.path,
            loader: wrappedLoader,
            name: config.name,
            data: config.data,
            useAsDefault: config.useAsDefault
        });
    }
    if (config instanceof route_config_decorator_1.Route || config instanceof route_config_decorator_1.Redirect || config instanceof route_config_decorator_1.AuxRoute) {
        return config;
    }
    if ((+!!config.component) + (+!!config.redirectTo) + (+!!config.loader) != 1) {
        throw new BaseException("Route config should contain exactly one \"component\", \"loader\", or \"redirectTo\" property.");
    }
    if (config.as && config.name) {
        throw new BaseException("Route config should contain exactly one \"as\" or \"name\" property.");
    }
    if (config.as) {
        config.name = config.as;
    }
    if (config.loader) {
        var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
        return new route_config_decorator_1.AsyncRoute({
            path: config.path,
            loader: wrappedLoader,
            name: config.name,
            data: config.data,
            useAsDefault: config.useAsDefault
        });
    }
    if (config.aux) {
        return new route_config_decorator_1.AuxRoute({ path: config.aux, component: config.component, name: config.name });
    }
    if (config.component) {
        if (typeof config.component == 'object') {
            var componentDefinitionObject = config.component;
            if (componentDefinitionObject.type == 'constructor') {
                return new route_config_decorator_1.Route({
                    path: config.path,
                    component: componentDefinitionObject.constructor,
                    name: config.name,
                    data: config.data,
                    useAsDefault: config.useAsDefault
                });
            }
            else if (componentDefinitionObject.type == 'loader') {
                return new route_config_decorator_1.AsyncRoute({
                    path: config.path,
                    loader: componentDefinitionObject.loader,
                    name: config.name,
                    data: config.data,
                    useAsDefault: config.useAsDefault
                });
            }
            else {
                throw new BaseException("Invalid component type \"" + componentDefinitionObject.type + "\". Valid types are \"constructor\" and \"loader\".");
            }
        }
        return new route_config_decorator_1.Route(config);
    }
    if (config.redirectTo) {
        return new route_config_decorator_1.Redirect({ path: config.path, redirectTo: config.redirectTo });
    }
    return config;
}
452885
function resolve (specs, opts) {
  const err = validate(specs)
  if (err) {
    return Promise.reject(err)
  }
  const options = opts || {}
  const dir = options.dir || '.'
  const dest = options.dest || 'public'
  return Promise.all(normalize(specs))
    .map((spec) => {
      return Promise.resolve(globby(spec.files, { cwd: dir, nodir: true }))
        .map(filename => createFileUsingSpec(filename, spec, dest))
    }).then(flatten)
}
866916
function resolvePlugins(definition: SchemaDefinition) {
  return promiseReduce(
    definition._plugins,
    (accum, p, name) => {
      const { plugin, installed } = p;
      if (!installed) {
        assert(
          plugin instanceof GraphQLFactoryPlugin,
          `plugin ${name} is not an instance of GraphQLFactoryPlugin`,
        );
        if (plugin.dependenciesMet(definition)) {
          definition.merge(plugin);
          return Promise.resolve(plugin.install(definition)).then(() => {
            p.installed = true;
          });
        }
      }
    },
    null,
    true,
  );
}