Takes a param section from a metadata class and returns a param string for the service method
333089
def service_param_string(params):
    """"""
    p = []
    k = []
    for param in params:
        name = fix_param_name(param['name'])
        if 'required' in param and param['required'] is True:
            p.append(name)
        else:
            if 'default' in param:
                k.append('{name}={default}'.format(name=name, default=param['default']))
            else:
                k.append('{name}=None'.format(name=name))
    p.sort(lambda a, b: len(a) - len(b))
    k.sort()
    a = p + k
    return ', '.join(a)
872494
public void serviceParameter(String pParameter, PageContext pPageContext) throws ServletException, IOException {
        Object param = pPageContext.getRequest().getAttribute(pParameter);

        if (param != null) {
            if (param instanceof Param) {
                ((Param) param).service(pPageContext);
            }
            else {
                pPageContext.getOut().print(param);
            }
        }
        else {
            // Try to get value from parameters
            Object obj = pPageContext.getRequest().getParameter(pParameter);

            // Print parameter or default value
            pPageContext.getOut().print((obj != null) ? obj : "");
        }
    }
1016216
public static String getMethodName(ServiceMethod serviceMethod) {
        String name = serviceMethod.getName();
        String formattedName = Formatter.toCamelCase(name);
        if (isReservedKeyword(formattedName)) {
            return formattedName + '_';
        }
        return formattedName;
    }
265741
@Override
	protected String getServiceName(final String methodName) {
		if (methodName != null) {
			int ndx = methodName.indexOf(this.separator);
			if (ndx > 0) {
				return methodName.substring(0, ndx);
			}
		}
		return methodName;
	}
456092
function getParams(spec_c, details, method, parent) {
  var spec_js = {};
  _.each(spec_c, function(param) {
    try {
      var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
      var paramName = getText(getChild(param, 'declname'), 'name');
      spec_js[paramName] = { type: paramType };
    } catch(e) {
      if (paramType == '...') {
        spec_js['arguments'] = { type: paramType };
      } else {
        throw e;
      }
    }
  });
  _.each(details, function(param) {
    var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
    var paramName = getParamName(param);
    var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
    if (_.has(spec_js, paramName)) {
      spec_js[paramName].description = paramDescription;
    } else {
      var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
      var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
      var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
      console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
    }
  });
  return spec_js;
}
1008265
private MBeanParameterInfo[] buildOperationParameterInfo(Method method, JmxOperationInfo operationInfo) {
		Class<?>[] types = method.getParameterTypes();
		MBeanParameterInfo[] parameterInfos = new MBeanParameterInfo[types.length];
		String[] parameterNames = operationInfo.getParameterNames();
		String[] parameterDescriptions = operationInfo.getParameterDescriptions();
		for (int i = 0; i < types.length; i++) {
			String parameterName;
			if (parameterNames == null || i >= parameterNames.length) {
				parameterName = "p" + (i + 1);
			} else {
				parameterName = parameterNames[i];
			}
			String typeName = types[i].getName();
			String description;
			if (parameterDescriptions == null || i >= parameterDescriptions.length) {
				description = "parameter #" + (i + 1) + " of type: " + typeName;
			} else {
				description = parameterDescriptions[i];
			}
			parameterInfos[i] = new MBeanParameterInfo(parameterName, typeName, description);
		}
		return parameterInfos;
	}
696075
def simxGetStringParameter(clientID, paramIdentifier, operationMode):
    '''
    
    '''
    paramValue = ct.POINTER(ct.c_char)()
    ret = c_GetStringParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode)
    
    a = bytearray()
    if ret == 0:
        i = 0
        while paramValue[i] != b'\0':
            if sys.version_info[0] == 3:
                a.append(int.from_bytes(paramValue[i],'big'))
            else:
                a.append(paramValue[i])
            i=i+1
    if sys.version_info[0] == 3:
        a=str(a,'utf-8')
    else:
        a=str(a)
    return ret, a
458529
@Nullable
  public static String extractFullServiceName(String fullMethodName) {
    int index = checkNotNull(fullMethodName, "fullMethodName").lastIndexOf('/');
    if (index == -1) {
      return null;
    }
    return fullMethodName.substring(0, index);
  }
624643
def _parse_parameters(self, resource, params):
        '''
        '''
        # remove params from resource URI (needed for paginated stuff)
        parsed_uri = urlparse(resource)
        qs = parsed_uri.query
        resource = urlunparse(parsed_uri._replace(query=''))
        prms = {}
        for tup in parse_qsl(qs):
            prms[tup[0]] = tup[1]

        # params supplied to self.get() override parsed params
        for key in params:
            prms[key] = params[key]
        return resource, prms
465892
def _query_param_from_api_repr(resource):
    """"""
    qp_type = resource["parameterType"]
    if "arrayType" in qp_type:
        klass = ArrayQueryParameter
    elif "structTypes" in qp_type:
        klass = StructQueryParameter
    else:
        klass = ScalarQueryParameter
    return klass.from_api_repr(resource)
1006576
def from_string(cls, string, *, default_func=None):
        '''
        '''
        if not isinstance(string, str):
            raise TypeError(f'service must be a string: {string}')

        parts = string.split('://', 1)
        if len(parts) == 2:
            protocol, address = parts
        else:
            item, = parts
            protocol = None
            if default_func:
                if default_func(item, ServicePart.HOST) and default_func(item, ServicePart.PORT):
                    protocol, address = item, ''
                else:
                    protocol, address = default_func(None, ServicePart.PROTOCOL), item
            if not protocol:
                raise ValueError(f'invalid service string: {string}')

        if default_func:
            default_func = partial(default_func, protocol.lower())
        address = NetAddress.from_string(address, default_func=default_func)
        return cls(protocol, address)
504529
def parse_param(self, core_param):
        
        return {
            'var_name': core_param.py_name,
            'api_name': core_param.name,
            'required': core_param.required,
            'docs': self.strip_html(core_param.documentation),
            'type': core_param.type,
        }
652128
private byte[] getBody(String method) {
        byte[] body = null;
    	String methodsWithInputEntity = HttpMethod.POST.name() + "|" + HttpMethod.PUT.name() + "|" + HttpMethod.DELETE.name();
    	if (method.matches(methodsWithInputEntity)) {
            if (isCompound()) {
                body = Utils.toBytes(getQueryInputEntity());
            }
            else {
                if (metadataJson.containsKey(INPUT_ENTITY)) {
                    JSONable data = (JSONable)commandParams.get(metadataJson.getString(INPUT_ENTITY));
                    if (data != null) {
                        body = Utils.toBytes(data.toJSON());
                    }
                }
            }
        }
        return body;
    }
641249
def get_parameter(self, name):
        
        name = adapt_name_for_rest(name)
        url = '/mdb/{}/parameters{}'.format(self._instance, name)
        response = self._client.get_proto(url)
        message = mdb_pb2.ParameterInfo()
        message.ParseFromString(response.content)
        return Parameter(message)
88473
function (methodName) {
            var parameters = this.smd.parameters || [];

            parameters = parameters.concat(this.smd.services[methodName].parameters || []);

            return parameters;
        }
69344
function getMetaBody(sectionString) {
    var sectionBody = {};
    var sectionBodyObj = {};
    var metaBodyCode = /-{2,}((\n*?\*{3,}[\S\s]+\*{3,})|(\n{2,}))[\S\s]+?\n{3,}/gi;
    var objectStrings = sectionString.match(metaBodyCode);
    for (var obj = 0; obj < objectStrings.length; obj++) {
        var sectionChild = processMetaChild(objectStrings[obj]);
        if (!isEmpty(sectionChild)) {
            sectionBodyObj.type = 'cms';
            //get only the number from version
            var versionRegExp = /\(v[\S\s]+?\)/;
            var version = sectionChild[0].match(versionRegExp)[0];
            version = trimStringEnds(version, ['(', ')', 'v']);
            sectionBodyObj.version = version;
            sectionBodyObj.timestamp = sectionChild[1];
        }
    }
    sectionBody.data = [sectionBodyObj];
    return sectionBody;

}
114803
public String getRequestParam(HttpServletRequest request, String param, String defaultValue)
    {
        String value = request.getParameter(servicePid + '.' + param);
        if ((value == null) && (properties != null))
            value = properties.get(servicePid + '.' + param);
        if (value == null)
            value = request.getParameter(param);
        if ((value == null) && (properties != null))
            value = properties.get(param);
        if (value == null)
                value = defaultValue;
        return value;
    }