Create an injector with a callable config if not present, otherwise, do nothing.
346155
def configure_once(config=None, bind_in_runtime=True):
    """"""
    with _INJECTOR_LOCK:
        if _INJECTOR:
            return _INJECTOR

        return configure(config, bind_in_runtime=bind_in_runtime)
1320195
function workFn() {
      var spec = getCurrentSpec();
      if (spec.$injector) {
        throw Error('Injector already created, can not register a module!');
      } else {
        var modules = spec.$modules || (spec.$modules = []);
        angular.forEach(moduleFns, function(module) {
          modules.push(module);
        });
      }
    }
621774
function createPlatform(injector) {
	        if (_platform && !_platform.destroyed) {
	            throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
	        }
	        _platform = injector.get(PlatformRef);
	        var inits = injector.get(PLATFORM_INITIALIZER, null);
	        if (inits)
	            inits.forEach(function (init) { return init(); });
	        return _platform;
	    }
86860
def make(self, cwl):
        """"""
        load = load_tool.load_tool(cwl, self.loading_context)
        if isinstance(load, int):
            raise Exception("Error loading tool")
        return Callable(load, self)
1298923
function createProviderInjector(cache) {
	const injector = createInjector(cache, function(name) {
		throw new Error(`Unknown provider: ${name}`);
	});

	injector.cache = cache;

	cache.$injector = injector;

	return injector;
}
1075531
function addInject(obj, inject) {
    if(!exists(inject)) {
      return;
    }

    var injectMe;

    if (inject === '$injector') {
      injectMe = new di.Inject(di.Injector);
    } else if (isObject(inject)) {
      if(isString(inject.inject)){
        injectMe = new di.Inject(inject.inject);
      } else if(isString(inject.promise)) {
        injectMe = new di.InjectPromise(inject.promise);
      } else if(isString(inject.lazy)) {
        injectMe = new di.InjectLazy(inject.lazy);
      }
    } else {
      injectMe = new di.Inject(inject);
    }

    di.annotate(obj, injectMe);
  }
1194622
function(callback) {
            var toInit = ['config', 'logger'];
            loader.loadServices(path.resolve(serverRoot, 'services'));
            injectDependencies(loader);

            loader.init(toInit, function(err) {
                callback(err);
            });
        }
1041039
function createInjector(options) {

  options = options || {};

  var configModule = {
    'config': ['value', options]
  };

  var modules = [ configModule, CoreModule ].concat(options.modules || []);

  return bootstrap(modules);
}
693649
def inject_config(self, config, from_args):
    
    # First get required values from labelStore
    runtime = self._get_runtime()
    whitelist = self._get_whitelist()
    #Run introspection on the libraries to retrieve list of libraries to link
    found_libraries = self._run_introspection(runtime, whitelist, verbose=True)
    container_path_set=set()
    for library in found_libraries:

      #disallow duplicate library targets
      cpath = self.__get_container_path(library)
      if cpath in container_path_set:
        continue
      container_path_set.add(cpath)

      config.append('--volume={0}:{1}'.format(library, cpath))
    
    config.extend(['-e', 'LD_LIBRARY_PATH={0}'.format(_container_lib_location)])
    config.extend(['-e', 'LIBGL_DRIVERS_PATH={0}'.format(_container_lib_location)])
924561
def create_callable(hook)
      callback = proc do |trans_event, *data|
        machine.instance_exec(trans_event, *data, &hook)
      end
      Callable.new(callback)
    end
789987
@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		
		INJECTOR_CONFIGURATION = Injector.Configuration.newInstance(this);
	}
1366074
function injectBefore(replServer, method, beforeFn) {
  var _orig = replServer[method];
  replServer[method] = function() {
    var args = Array.prototype.slice.call(arguments);
    var callback = args.pop();
    beforeFn.apply(null, args.concat(function(err, res) {
      if (err || res) {
        callback(err, res);
      } else {
        _orig.apply(replServer, args.concat(callback));
      }
    }));
  };
  return replServer;
}
861659
def global_injector_decorator(inject_globals):
    '''
    
    '''
    def inner_decorator(f):
        @functools.wraps(f)
        def wrapper(*args, **kwargs):
            with salt.utils.context.func_globals_inject(f, **inject_globals):
                return f(*args, **kwargs)
        return wrapper
    return inner_decorator
880794
function createInternalInjector(cache, factory) {

    function getService(serviceName, caller) {
      if (cache.hasOwnProperty(serviceName)) {
        if (cache[serviceName] === INSTANTIATING) {
          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
                    serviceName + ' <- ' + path.join(' <- '));
        }
        return cache[serviceName];
      } else {
        try {
          path.unshift(serviceName);
          cache[serviceName] = INSTANTIATING;
          return cache[serviceName] = factory(serviceName, caller);
        } catch (err) {
          if (cache[serviceName] === INSTANTIATING) {
            delete cache[serviceName];
          }
          throw err;
        } finally {
          path.shift();
        }
      }
    }

    function invoke(fn, self, locals, serviceName) {
      if (typeof locals === 'string') {
        serviceName = locals;
        locals = null;
      }

      var args = [],
          $inject = createInjector.$$annotate(fn, strictDi, serviceName),
          length, i,
          key;

      for (i = 0, length = $inject.length; i < length; i++) {
        key = $inject[i];
        if (typeof key !== 'string') {
          throw $injectorMinErr('itkn',
                  'Incorrect injection token! Expected service name as string, got {0}', key);
        }
        args.push(
          locals && locals.hasOwnProperty(key)
          ? locals[key]
          : getService(key, serviceName)
        );
      }
      if (isArray(fn)) {
        fn = fn[length];
      }

      // http://jsperf.com/angularjs-invoke-apply-vs-switch
      // #5388
      return fn.apply(self, args);
    }

    function instantiate(Type, locals, serviceName) {
      // Check if Type is annotated and use just the given function at n-1 as parameter
      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
      // Object creation: http://jsperf.com/create-constructor/2
      var instance = Object.create((isArray(Type) ? Type[Type.length - 1] : Type).prototype || null);
      var returnedValue = invoke(Type, instance, locals, serviceName);

      return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;
    }

    return {
      invoke: invoke,
      instantiate: instantiate,
      get: getService,
      annotate: createInjector.$$annotate,
      has: function(name) {
        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
      }
    };
  }
1108823
function (name) {
        if (JOII.Config.callables.indexOf(name) !== -1) {
            return;
        }

        JOII.Config.callables.push(name);
    }
681738
function Injector(obj){
  var services = {};
  var get = name => {
    if(!(name in services)){
      const err = new Error(`[injector] service "${name}" not found`);
      return Promise.reject(err);
    }
    return services[name];
  };
  if(typeof obj === 'object')
    services = obj;
  if(typeof obj === 'function')
    get = obj;
  function resolve(name) {
    let service = get(name);
    if(typeof service === 'function')
      service = invoke(service);
    return service;
  };
  function invoke(fn, that){
    return Promise
    .all(getParameterNames(fn).map(resolve))
    .then(params => fn.apply(that, params));
  }
  return invoke;
}
86751
def clear_and_configure(config=None, bind_in_runtime=True):
    """"""
    with _INJECTOR_LOCK:
        clear()
        return configure(config, bind_in_runtime=bind_in_runtime)