Decodes arguments given a method's parameter list
503357
private Arg[] getMethodArguments(List<Parameter> param)
    {
        
         Arg[] val = new Arg[param.size()];
        for (int i = 0; i < param.size(); i++)
        {
            String type = param.get(i).type;

            Arg arg = new Arg();
            arg.type = type;
            arg.name = param.get(i).name;
            Object v = null;
            String type1 = null;
            try
            {            
                type1 = this.getMappedType(type);              
                v = getObjectOfType(type1);
            }
            catch (Exception e)
            {
                throw new IllegalStateException("type codec failed for type " + type + " for domain " + e.getMessage());
            }

            // support unpacking of consecutive bits from a single byte
            this.bitCount = (byte)((type1 == "Bit") ? this.bitCount + 1 : 0);

            arg.value = v;
            val[i]=arg;            
        }

        return val;
    }
635486
function getParams(args) {
        var params = slice.call(args);
        var length = params.length;
        if (length === 1 && is.array(params[0])) {    // support array
            params = params[0];
        }
        return params;
    }
1204555
def decode_list(input_props, name):
    # type: (Dict[str, str], str) -> List[str]
    
    val_str = input_props.get(name, None)
    if val_str:
        return val_str.split(" ")
    return []
333071
def serialize_args(self):
        """"""

        args, kwargs = super(MultiParameter, self).serialize_args()
        args.insert(0, [[t.id, t.serialize_args()] for t in self.types])

        return args, kwargs
1054492
def getParams(options=None):
    
    result = []
    if options:
        members = options.__dict__
        for k, v in sorted(members.items()):
            result.append("# %-40s: %s" % (k, str(v)))
    else:
        vars = inspect.currentframe().f_back.f_locals
        for var in filter(lambda x: re.match("param_", x), vars.keys()):
            result.append("# %-40s: %s" %
                          (var, str(vars[var])))

    if result:
        return "\n".join(result)
    else:
        return "# no parameters."
1043819
def get_param_arg(param, idx, klass, arg, attr='id'):
    """"""
    if isinstance(arg, klass):
        return getattr(arg, attr)
    elif isinstance(arg, (int, str)):
        return arg
    else:
        raise TypeError(
            "%s[%d] must be int, str, or %s, not %s" % (
                param, idx, klass.__name__, type(arg).__name__))
1059470
def _EncodeParameters(self, parameters):
        

        if parameters is None:
            return None
        else:
            return urlencode(dict([(k, self._Encode(v)) for k, v in list(parameters.items()) if v is not None]))
552470
private synchronized Map<String, String[]> parseParameters(String s)
    {
        Map<String, List<String>> parameterMap;
        Map<String, String[]> result;
        StringTokenizer st;

        parameterMap = new HashMap<>();
        result = new HashMap<>();

        if (s == null)
        {
            return result;
        }

        st = new StringTokenizer(s, "&");
        while (st.hasMoreTokens())
        {
            String parameter;
            Matcher parameterMatcher;
            String name;
            String value;
            List<String> values;

            parameter = st.nextToken();
            parameterMatcher = PARAMETER_PATTERN.matcher(parameter);
            if (parameterMatcher.matches())
            {
                try
                {
                    name = URLDecoder.decode(parameterMatcher.group(1), "UTF-8");
                    value = URLDecoder.decode(parameterMatcher.group(2), "UTF-8");
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }
            else
            {
                try
                {
                    name = URLDecoder.decode(parameter, "UTF-8");
                    value = "";
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }

            if (parameterMap.get(name) == null)
            {
                values = new ArrayList<>();
                values.add(value);
                parameterMap.put(name, values);
            }
            else
            {
                values = parameterMap.get(name);
                values.add(value);
            }
        }

        for (Map.Entry<String, List<String>> entry : parameterMap.entrySet())
        {
            String[] valueArray;

            valueArray = new String[entry.getValue().size()];
            result.put(entry.getKey(), entry.getValue().toArray(valueArray));
        }

        return result;
    }
16557
def _parameters(cls, tokens):
        
        arguments = []
        options = []

        for token in tokens:
            if not token.startswith("--"):
                arguments.append(cls._parse_argument(token))
            else:
                options.append(cls._parse_option(token))

        return {"arguments": arguments, "options": options}
570139
protected int decodeMandatoryVariableParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        // FIXME: possibly this should also be per msg, since if msg lacks
        // proper parameter, decoding wotn pick this up and will throw
        // some bad output, which wont give a clue about reason...
        int readCount = 0;
        // int optionalOffset = 0;

        if (b.length - index > 0) {

            byte extPIndex = -1;
            try {
                int count = getNumberOfMandatoryVariableLengthParameters();
                readCount = count;
                for (int parameterIndex = 0; parameterIndex < count; parameterIndex++) {
                    int lengthPointerIndex = index + parameterIndex;
                    int parameterLengthIndex = b[lengthPointerIndex] + lengthPointerIndex;

                    int parameterLength = b[parameterLengthIndex];
                    byte[] parameterBody = new byte[parameterLength];
                    System.arraycopy(b, parameterLengthIndex + 1, parameterBody, 0, parameterLength);
                    decodeMandatoryVariableBody(parameterFactory, parameterBody, parameterIndex);

                }

                // optionalOffset = b[index + readCount];
            } catch (ArrayIndexOutOfBoundsException aioobe) {
                throw new ParameterException(
                        "Failed to read parameter, to few octets in buffer, parameter index: " + extPIndex, aioobe);
            } catch (IllegalArgumentException e) {
                throw new ParameterException("Failed to parse, paramet index: " + extPIndex, e);
            }
        } else {
            throw new ParameterException(
                    "To few bytes to decode mandatory variable part. There should be atleast on byte to indicate optional part.");
        }

        // return readCount + optionalOffset;
        return readCount;
    }
1342588
function (params, funAbi, callback) {
    var data = ''
    var dataHex = ''
    var funArgs
    if (params.indexOf('raw:0x') === 0) {
      // in that case we consider that the input is already encoded and *does not* contain the method signature
      dataHex = params.replace('raw:0x', '')
      data = Buffer.from(dataHex, 'hex')
    } else {
      try {
        params = params.replace(/(^|,\s+|,)(\d+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted number by quoted number
        params = params.replace(/(^|,\s+|,)(0[xX][0-9a-fA-F]+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted hex string by quoted hex string
        funArgs = JSON.parse('[' + params + ']')
      } catch (e) {
        callback('Error encoding arguments: ' + e)
        return
      }
      if (funArgs.length > 0) {
        try {
          data = helper.encodeParams(funAbi, funArgs)
          dataHex = data.toString('hex')
        } catch (e) {
          callback('Error encoding arguments: ' + e)
          return
        }
      }
      if (data.slice(0, 9) === 'undefined') {
        dataHex = data.slice(9)
      }
      if (data.slice(0, 2) === '0x') {
        dataHex = data.slice(2)
      }
    }
    callback(null, { data: data, dataHex: dataHex, funArgs: funArgs })
  }
912966
private String parameterToString(Object param) {
        if (param == null) {
            return "";
        } else if (param instanceof Date) {
            return formatDate((Date) param);
        } else if (param instanceof Collection) {
            StringBuilder b = new StringBuilder();
            for (Object o : (Collection) param) {
                if (b.length() > 0) {
                    b.append(",");
                }
                b.append(String.valueOf(o));
            }
            return b.toString();
        } else {
            return String.valueOf(param);
        }
    }
1362131
def parse_analyzer_arguments(arguments):
    

    rets = []

    for argument in arguments:
        args = argument.split(argument_splitter)

        # The first one is the function name
        func_name = args[0]

        # The rest is the args
        func_args = {}

        for arg in args[1:]:
            key, value = parse_arg(arg)

            func_args[key] = value

        rets.append(FunctionArguments(function=func_name, arguments=func_args))

    return rets
722533
function methodToAbi (method) {
  const length = method.length;
  const typesStart = method.indexOf('(');
  const typesEnd = method.indexOf(')');

  if (typesStart === -1) {
    throw new Error(`Missing start ( in call to decodeMethod with ${method}`);
  } else if (typesEnd === -1) {
    throw new Error(`Missing end ) in call to decodeMethod with ${method}`);
  } else if (typesEnd < typesStart) {
    throw new Error(`End ) is before start ( in call to decodeMethod with ${method}`);
  } else if (typesEnd !== length - 1) {
    throw new Error(`Extra characters after end ) in call to decodeMethod with ${method}`);
  }

  const name = method.substr(0, typesStart);
  const types = method.substr(typesStart + 1, length - (typesStart + 1) - 1).split(',');
  const inputs = types.filter((_type) => _type.length).map((_type) => {
    const type = fromParamType(toParamType(_type));

    return { type };
  });

  return { type: 'function', name, inputs };
}
756159
def format_param(p):
    ""
    arg_prefix = arg_prefixes.get(p.kind, '') # asterisk prefix for *args and **kwargs
    res = f"**{arg_prefix}{code_esc(p.name)}**"
    if hasattr(p, 'annotation') and p.annotation != p.empty: res += f':{anno_repr(p.annotation)}'
    if p.default != p.empty:
        default = getattr(p.default, 'func', p.default)
        default = getattr(default, '__name__', default)
        res += f'=***`{repr(default)}`***'
    return res
92002
def __parameter_enum(self, param):
    
    if isinstance(param, messages.EnumField):
      return [enum_entry[0] for enum_entry in sorted(
          param.type.to_dict().items(), key=lambda v: v[1])]
1927
def encode_matrix_parameters(parameters):
    
    result = []

    for param in iter(sorted(parameters)):
        if isinstance(parameters[param], (list, tuple)):
            value = (';%s=' % (param)).join(parameters[param])
        else:
            value = parameters[param]

        result.append("%s=%s" % (param, value))

    return ';'.join(result)