Resolve service argument.
179415
protected function resolveServiceArgument(string $name, ReflectionClass $type, ReflectionParameter $param)
    {
        $type_class = $type->getName();

        if ($type_class === $name) {
            throw new RuntimeException('class '.$type_class.' can not depend on itself');
        }

        try {
            return $this->traverseTree($name, $type_class);
        } catch (\Exception $e) {
            if ($param->isDefaultValueAvailable() && null === $param->getDefaultValue()) {
                return null;
            }

            throw $e;
        }
    }
580128
public function resolve(object $message, ServiceBusContext $context, MessageHandlerArgument $argument): object
    {
        /** @var object $object */
        $object = $this->serviceLocator->get((string) $argument->typeClass);

        return $object;
    }
496923
async def resolve(self, client):
        """"""
        if self.resolved:
            return

        if not self._resolve_lock:
            self._resolve_lock = asyncio.Lock(loop=client.loop)

        async with self._resolve_lock:
            if not self.resolved:
                await self._resolve(client)
                self.resolved = True
1319848
def service(ctx):
    """"""

    install_service(ctx.obj['instance'], ctx.obj['dbhost'], ctx.obj['dbname'], ctx.obj['port'])
1202441
function resolveClient(c,arg)
		{
			if(typeof c.y === "function")
			{
				try {
						var yret = c.y.call(_undefined,arg);
						c.p.resolve(yret);
					}
				catch(err) { c.p.reject(err) }
			}
			else
				c.p.resolve(arg); // pass this along...
		}
674030
def resolve(self):
        ''
        return os.path.expandvars(os.path.expanduser(self.fqpn))
328953
private function resolveArgument($argument)
    {
        if (is_array($argument)) {
            return array_map(array($this, 'resolveArgument'), $argument);
        }

        if (!is_string($argument)) {
            return $argument;
        }

        $container = $this->kernel->getContainer();
        $container = $container->has('test.service_container') ? $container->get('test.service_container') : $container;

        if ($service = $this->getService($container, $argument)) {
            return $service;
        }

        $resolvedParam = $this->replaceParameters($container, $argument);

        if (!is_string($resolvedParam)) {
            return $resolvedParam;
        }

        return $this->escape($resolvedParam);
    }
968101
private Class<?> resolveArgument(Type type) {
    if (type instanceof ParameterizedType) {
      ParameterizedType paramType = (ParameterizedType) type;
      return resolveClass(paramType.getActualTypeArguments()[0]);
    } else if (type instanceof TypeVariable) {
      return resolveClass(type);
    } else if (type instanceof Class) {
      TypeVariable<?>[] typeParams = ((Class<?>) type).getTypeParameters();
      return resolveClass(typeParams[0]);
    }
    return null;
  }
15894
function resolve(opt) {
	if (opt instanceof Serializers.Base) {
		return opt;
	} else if (_.isString(opt)) {
		let SerializerClass = getByName(opt);
		if (SerializerClass)
			return new SerializerClass();
		else
			throw new BrokerOptionsError(`Invalid serializer type '${opt}'.`, { type: opt });

	} else if (_.isObject(opt)) {
		let SerializerClass = getByName(opt.type || "JSON");
		if (SerializerClass)
			return new SerializerClass(opt.options);
		else
			throw new BrokerOptionsError(`Invalid serializer type '${opt.type}'.`, { type: opt.type });
	}

	return new Serializers.JSON();
}
248288
def fetch(cls, id, service=None, endpoint=None, *args, **kwargs):
        """"""
        if service is None and endpoint is None:
            raise InvalidArguments(service, endpoint)

        if endpoint is None:
            sid = service['id'] if isinstance(service, Entity) else service
            endpoint = 'services/{0}/integrations'.format(sid)

        return getattr(Entity, 'fetch').__func__(cls, id, endpoint=endpoint,
                                                 *args, **kwargs)
703255
Symbol resolveUnaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type arg) {
        return resolveOperator(pos, optag, env, List.of(arg));
    }
266398
def _replace_service_arg(self, name, index, args):
        
        args[index] = self.get_instantiated_service(name)
347258
def services_resolved(self):
        
        self._disconnect_service_signals()

        services_regex = re.compile(self._device_path + '/service[0-9abcdef]{4}$')
        managed_services = [
            service for service in self._object_manager.GetManagedObjects().items()
            if services_regex.match(service[0])]
        self.services = [Service(
            device=self,
            path=service[0],
            uuid=service[1]['org.bluez.GattService1']['UUID']) for service in managed_services]

        self._connect_service_signals()
290767
protected function resolve()
    {
        $extensionsManager = $this->getServiceLocator()->get(\common_ext_ExtensionsManager::SERVICE_ID);
        $installed = $extensionsManager->getInstalledExtensionsIds();
        foreach ($installed as $extId) {
            $extension = $extensionsManager->getExtensionById($extId);
            foreach ($this->getRoutes($extension) as $entry) {
                /** @var Route $route */
                $route = $entry['route'];
                $called = $route->resolve($this->getRequest());
                if ($called !== null) {
                    list($controller, $action) = explode('@', $called);
                    $this->controller = $controller;
                    $this->action = $action;
                    $this->extensionId = $entry['extId'];

                    return true;
                }
            }
        }

        throw new \ResolverException('Unable to resolve '.$this->request->getUri()->getPath());
    }
1144463
def resolve(self, client):
        """"""

        resolve_method = getattr(client, snake_case(self.link_type))
        if self.link_type == 'Space':
            return resolve_method()
        else:
            return resolve_method(self.id)
1335391
function resolveValueArgs (data, property, resolveValueArgs) {
    // make sure that args are object
    resolveValueArgs = typeof resolveValueArgs === 'object' ? resolveValueArgs : {}
    // set true if property is id colum
    var isIdColumn = false
    // set true if id co lumn is original id
    var isOriginalId = false
    // set true if property is plural
    var isPlural = property.slice(-1) === 's'
    // it model property is not set then derive from property
    if (!defined(resolveValueArgs.modelProperty)) {
        // make sure property does not have `s` on end
        resolveValueArgs.modelProperty = isPlural
            ? property.slice(0, -1)
            : property
    }
    // set id flags for model property
    if (resolveValueArgs.modelProperty.slice(-2) === 'Id') {
        // column is id column
        isIdColumn = true
        // check if column is originalId
        isOriginalId = resolveValueArgs.modelProperty.slice(-10) === 'OriginalId'
    }
    // if model name is defined validate
    if (defined(resolveValueArgs.modelName)) {
        // throw error on invalid model name
        if (!this.query.model.hasModel(resolveValueArgs.modelName)) {
            throw this.query.error(`invalid modelName ${resolveValueArgs.modelName} in resolve`)
        }
    }
    else {
        if (isIdColumn) {
            // get model name by removing the id
            resolveValueArgs.modelName = isOriginalId
                ? resolveValueArgs.modelProperty.slice(0, -10)
                : resolveValueArgs.modelProperty.slice(0, -2)
        }
        // property is a model name
        else {
            resolveValueArgs.modelName = resolveValueArgs.modelProperty
        }
        // skip unless property has a valid model name
        if (!this.query.model.hasModel(resolveValueArgs.modelName)) {
            return
        }
    }
    // get model instance
    resolveValueArgs.model = this.query.model.getModel(resolveValueArgs.modelName)
    // get id column
    resolveValueArgs.idColumn = resolveValueArgs.model.columnName('id')
    // skip if model has no id column
    if (!defined(resolveValueArgs.idColumn)) {
        return
    }
    // if object-array flag is not set in args then check data to set
    if (!defined(resolveValueArgs.isObjectArray)) {
        // get value
        var value = _.get(data, property)
        // value is array of objects
        if (Array.isArray(value) && typeof value[0] === 'object' && value[0]) {
            // set flag true
            resolveValueArgs.isObjectArray = true
            // get original id column
            var originalIdColumn = resolveValueArgs.model.columnName('originalId')
            // if original id column is set in value then query by original id
            if (defined(value[0][originalIdColumn])) {
                isOriginalId = true
                resolveValueArgs.objectArrayProperty = originalIdColumn
            }
            // otherwise use id if defined
            else if (defined(value[0][resolveValueArgs.idColumn])) {
                isOriginalId = false
                resolveValueArgs.objectArrayProperty = resolveValueArgs.idColumn
            }
            // if neither id is in first data element then do not resolve
            else {
                return
            }
        }
        // value is not array of objects
        else {
            // set flag false
            resolveValueArgs.isObjectArray = false
        }
    }
    // set flags if not defined
    if (!defined(resolveValueArgs.isIdColumn)) {
        resolveValueArgs.isIdColumn = isIdColumn
    }
    if (!defined(resolveValueArgs.isOriginalId)) {
        resolveValueArgs.isOriginalId = isOriginalId
    }
    if (!defined(resolveValueArgs.isPlural)) {
        resolveValueArgs.isPlural = isPlural
    }
    // set common args
    resolveValueArgs.data = data
    resolveValueArgs.property = property
    resolveValueArgs.query = this.query

    return resolveValueArgs
}
1284941
async function validateArguments(serviceManifest) {
    let error = new Error();
    let body = undefined;
    error.name = 'ArgumentError';
    if (!serviceManifest) {
        error.message = 'The operation does not exist';
        throw error;
    }

    const {operation} = serviceManifest;
    if (!operation) {
        error.message = 'The operation does not exist';

        throw error;
    }

    const entitySpecified = typeof args.in === 'string';
    const entityRequired = !!operation.entityName;

    if (!entityRequired && entitySpecified) {
        error.message = `The ${operation.name} operation does not accept an input`;

        throw error;
    }

    if (entityRequired) {
        if (entitySpecified) {
            body = await getFileInput(args);
        }
        else {
            switch (serviceManifest.operation.name) {
                case 'generateAnswer':
                    body = {
                        question: args.question,
                        top: args.top
                    };
                    break;
                default:
                    error.message = `The ${operation.name} requires an input of type: ${operation.entityType}`;
                    throw error;
            }
        }
    }

    if (serviceManifest.operation.params) {
        for (let param of serviceManifest.operation.params) {
            if (param.required) {
                if (!args[param.name] && !args[param.alias || param.name]) {
                    error.message = `The --${param.name} argument is missing and required`;
                    throw error;
                }
            }
        }
    }

    // Note that the ServiceBase will validate params that may be required.
    return body;
}