Injects a service instance into the kwargs
191405
def pass_service(*names):
    
    def decorator(f):
        @functools.wraps(f)
        def wrapper(*args, **kwargs):
            for name in names:
                kwargs[name] = service_proxy(name)
            return f(*args, **kwargs)
        return wrapper
    return decorator
882260
@Override
    public InjectionBinding<WebServiceRef> createOverrideInjectionBinding(Class<?> instanceClass, Member member,
                                                                          Resource resource, String jndiName) throws InjectionException {

        Class<?> typeClass = resource.type();

        if (member != null) {
            Class<?> inferredType = InjectionHelper.getTypeFromMember(member);
            if (typeClass.getName().equals(Object.class.getName())) { //default
                typeClass = inferredType;
//            } else {
//                if (!inferredType.isAssignableFrom(typeClass)) {
//                    Tr.error(tc, "error.service.ref.member.level.annotation.type.not.compatible",
//                             member.getName(), member.getDeclaringClass().getName(), typeClass.getName(), inferredType.getName());
//                    throw new InjectionException(Tr.formatMessage(tc, "error.service.ref.member.level.annotation.type.not.compatible",
//                                                                  member.getName(), member.getDeclaringClass().getName(), typeClass.getName(), inferredType.getName()));
//                }
            }
        }

        InjectionBinding<WebServiceRef> binding;

        //only service type injections are possible with the @Resource annotation
        if (Service.class.isAssignableFrom(typeClass)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "The @Resource annotation found has type=" + typeClass.getName() + " and is refers to a JAX-WS service reference");
            }
            binding = WebServiceRefBindingBuilder.createWebServiceRefBindingFromResource(resource, ivNameSpaceConfig, typeClass, jndiName);
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "The @Resource annotation found did not refer to a web service reference type.");
            }
            binding = null;
        }

        return binding;
    }
53960
public void registerInstance(ProvidedServiceInstance instance){
        String body = _serialize(instance);
        HttpResponse result = invoker.invoke(toInstanceUri(instance.getServiceName(), instance.getProviderId()), body,
                HttpMethod.POST);

        if (result.getHttpCode() != HTTP_CREATED) {
            throw new ServiceException(ErrorCode.REMOTE_DIRECTORY_SERVER_ERROR,
                    "HTTP Code is not OK, code=%s",result.getHttpCode());
        }
    }
1086884
function injectorInjectInvokers(injector) {
	var invoke_ = injector.invoke;

	injector.instantiate = instantiate;
	injector.invoke = invoke;

	return injector;

	// pasted method that picks up patched 'invoke'
	function instantiate(Type, locals, serviceName) {
		var instance = Object.create((Array.isArray(Type) ? Type[Type.length - 1] : Type).prototype || null);
		var returnedValue = invoke(Type, instance, locals, serviceName);

		return (returnedValue !== null && typeof returnedValue === 'object') || (typeof returnedValue === 'function') ? returnedValue : instance;
	}

	function invoke() {
		var argsLength = arguments.length;
		var args = new Array(argsLength);
		for (var i = 0; i < argsLength; i++) {
			args[i] = arguments[i];
		}

		var nativeClassRegex = /^class/;
		var classRegex = /class/i;

		var invokeResult;
		var fn = args[0];
		var skipClassify = !angular.isFunction(fn) || fn.hasOwnProperty('$$classified');

		if (!skipClassify) {
			if (fn.$classify || nativeClassRegex.test(fn.toString())) {
				classifyInvokee(args);
			} else if (this.$classify || (this.$classify !== false && classRegex.test(fn.toString()))) {
				try {
					invokeResult = apply(injector, invoke_, args);
					fn.$$classified = false;
				} catch (e) {
					if (e instanceof TypeError && classRegex.test(e.message)) {
						classifyInvokee(args);
					} else {
						throw e;
					}
				}
			}	
		}

		return invokeResult || apply(injector, invoke_, args);
	}

	function classifyInvokee(args) {
		var fn_ = args[0]; 

		var fn = args[0] = function () {
			var fnArgsLength = arguments.length + 1;
			var fnArgs = new Array(fnArgsLength);
			for (var i = 1; i < fnArgsLength; i++) {
				fnArgs[i] = arguments[i - 1];
			}

			// fnArgs[0] === undefined 
			return new (apply(fn_, Function.prototype.bind, fnArgs));
		};

		injector.annotate(fn_);
		fn.$inject = fn_.$inject;
		fn.$$classified = true;
	}
}
703037
def register_service(self, **kwargs):
        
        kwargs.setdefault('name', self.app.name)
        self.session.agent.service.register(**kwargs)
582088
def register_service(self, service):
        
        if service not in self.services:
            self.services.append(service)
909090
def instance(*args, **kwargs):
        

        if not hasattr(Config, "_instance") or Config._instance is None:
            Config._instance = Config(*args, **kwargs)
        return Config._instance
1194622
function(callback) {
            var toInit = ['config', 'logger'];
            loader.loadServices(path.resolve(serverRoot, 'services'));
            injectDependencies(loader);

            loader.init(toInit, function(err) {
                callback(err);
            });
        }
656763
def instance(self, *args, **kwargs):
        
        mod, cls = self.get_module_class()
        inst = cls(*args, **kwargs)
        logger.debug(f'inst: {inst}')
        return inst
599990
def inject_extra_args(callback, request, kwargs):
    ''''''
    # TODO: this is a temporary pach, should be managed via honouring the
    # mimetype in the request header....
    annots = dict(callback.__annotations__)
    del annots['return']
    for param_name, (param_type, _) in annots.items():
        if param_type == Ptypes.path:
            continue  # Already parsed by werkzeug
        elif param_type == Ptypes.body:
            value = getattr(request, PTYPE_TO_REQUEST_PROPERTY[param_type])
            # TODO: The JSON conversion should be dependant from request
            # header type, really...
            value = json.loads(value.decode('utf-8'))
        else:
            get = lambda attr: getattr(request, attr).get(param_name, None)
            value = get(PTYPE_TO_REQUEST_PROPERTY[param_type])
        if value is not None:
            kwargs[param_name] = value
1270808
@Override
	public void injectServices(ServiceRegistryImplementor serviceRegistry) {
		if ( gridDialect instanceof ServiceRegistryAwareService ) {
			( (ServiceRegistryAwareService) gridDialect ).injectServices( serviceRegistry );
		}
	}
74953
def _replace_services_in_kwargs(self, kwargs):
        
        _check_type('kwargs', kwargs, dict)

        new_kwargs = {}
        for (name, value) in iteritems(kwargs):
            if isinstance(value, list):
                new_kwargs[name] = self._replace_services_in_args(value)
            elif isinstance(value, dict):
                new_kwargs[name] = self._replace_services_in_kwargs(value)
            elif isinstance(value, string_types):
                new_kwargs[name] = self._replace_service(value)
            else:
                new_kwargs[name] = value
        return new_kwargs
307574
private static Object injectAndPostConstruct(Object injectionProvider, Class Klass, List injectedBeanStorage)
    {
        Object instance = null;
        if (injectionProvider != null)
        {
            try
            {

                Object managedObject = _FactoryFinderProviderFactory.INJECTION_PROVIDER_INJECT_CLASS_METHOD.invoke(injectionProvider, Klass);

                instance = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_OBJECT_METHOD.invoke(managedObject, null);

                if (instance != null) {

                    Object creationMetaData = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD.invoke
                                    (managedObject, CreationalContext.class);

                    addBeanEntry(instance, creationMetaData, injectedBeanStorage);

                    _FactoryFinderProviderFactory.INJECTION_PROVIDER_POST_CONSTRUCT_METHOD.invoke(
                                                                                                  injectionProvider, instance, creationMetaData);
                }
            } catch (Exception ex)
            {
                throw new FacesException(ex);
            }
        }
        return instance;
    }
493946
public static void initialize(Object instance, Map namedArgs) {
        PersistentEntity dc = getDomainClass(instance);
        if (dc == null) {
            DataBindingUtils.bindObjectToInstance(instance, namedArgs);
        }
        else {
            DataBindingUtils.bindObjectToDomainInstance(dc, instance, namedArgs);
            DataBindingUtils.assignBidirectionalAssociations(instance, namedArgs, dc);
        }
        autowire(instance);
    }
852858
def wrap_kwargs_to_initdict(init_kwargs_fn: InitKwargsFnType,
                            typename: str,
                            check_result: bool = True) \
        -> InstanceToInitDictFnType:
    
    def wrapper(obj: Instance) -> InitDict:
        result = init_kwargs_fn(obj)
        if check_result:
            if not isinstance(result, dict):
                raise ValueError(
                    "Class {} failed to provide a kwargs dict and "
                    "provided instead: {}".format(typename, repr(result)))
        return kwargs_to_initdict(init_kwargs_fn(obj))

    return wrapper
1359002
@SuppressWarnings("unchecked")
    public void injectNonContextualInstance(final Object instance) {
        if (instance != null) {
            CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
            InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager
                    .createInjectionTarget(getAnnotatedType(instance));
            injectionTarget.inject(instance, creationalContext);
        }
    }
209094
function inject (taskKey) {
    var taskName = task[taskKey]

    var num = parseFloat(taskName)

    if (!isNaN(num)) {
      funcs[taskName] = function () { return num }
    }
  }