Craft an AVP based on its id and optional parameter fields
174146
def AVP(avpId, **fields):
    
    val = None
    classType = AVP_Unknown
    if isinstance(avpId, str):
        try:
            for vnd in AvpDefDict:
                for code in AvpDefDict[vnd]:
                    val = AvpDefDict[vnd][code]
                    if val[0][:len(
                            avpId)] == avpId:  # A prefix of the full name is considered valid  # noqa: E501
                        raise
            found = False
        except BaseException:
            found = True
    else:
        if isinstance(avpId, list):
            code = avpId[0]
            vnd = avpId[1]
        else:  # Assume this is an int
            code = avpId
            vnd = 0
        try:
            val = AvpDefDict[vnd][code]
            found = True
        except BaseException:
            found = False
    if not found:
        warning('The AVP identifier %s has not been found.' % str(avpId))
        if isinstance(avpId, str):  # The string input is not valid
            return None
    # At this point code, vnd are provisionned val may be set (if found is True)  # noqa: E501
    # Set/override AVP code
    fields['avpCode'] = code
    # Set vendor if not already defined and relevant
    if 'avpVnd' not in fields and vnd:
        fields['avpVnd'] = vnd
    # Set flags if not already defined and possible ...
    if 'avpFlags' not in fields:
        if val:
            fields['avpFlags'] = val[2]
        else:
            fields['avpFlags'] = vnd and 128 or 0
    # Finally, set the name and class if possible
    if val:
        classType = val[1]
    _ret = classType(**fields)
    if val:
        _ret.name = 'AVP ' + val[0]
    return _ret
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__))
294091
def process_bind_param(self, value: Optional[List[str]],
                           dialect: Dialect) -> str:
        """"""
        retval = self._strlist_to_dbstr(value)
        return retval
98185
private String parseParams(ParameterSet params, JSONObject obj) throws Exception
    {
        if (params.size() < 2) {
            return "@SnapshotDelete expects 2 or 3 arguments, received " + params.size();
        }
        String[] paths = null;
        Object paramList[] = params.toArray();
        try {
            paths = (String[])(ParameterConverter.tryToMakeCompatible(
                        String[].class,
                        paramList[0]));
        }
        catch (Exception e) {
            return e.getMessage();
        }

        if (paths == null || paths.length == 0) {
            return "No paths supplied";
        }

        for (String path : paths) {
            if (path == null || path.trim().isEmpty()) {
                return "A path was null or the empty string";
            }
        }

        String[] nonces = null;
        try {
            nonces = (String[])(ParameterConverter.tryToMakeCompatible(
                        String[].class,
                        paramList[1]));
        }
        catch (Exception e) {
            return e.getMessage();
        }

        if (nonces == null || nonces.length == 0) {
            return "No nonces supplied";
        }

        for (String nonce : nonces) {
            if (nonce == null || nonce.trim().isEmpty()) {
                return "A nonce was null or the empty string";
            }
        }

        if (paths.length != nonces.length) {
            return "A path must be provided for every nonce";
        }
        String stype = SnapshotPathType.SNAP_PATH.toString();
        if (params.size() > 2) {
            stype = (String )(ParameterConverter.tryToMakeCompatible(
                        String.class,
                        paramList[2]));
        }
        // Dupe SNAPSHOTSCAN as the subselector in case we consolidate later
        obj.put("subselector", "SNAPSHOTDELETE");
        obj.put("interval", false);
        obj.put("paths", paths);
        obj.put(SnapshotUtil.JSON_PATH_TYPE, stype);
        obj.put("nonces", nonces);

        return null;
    }
287726
private Object[] handleParameters(IoBuffer in, Notify notify, Input input) {
        Object[] params = new Object[] {};
        List<Object> paramList = new ArrayList<>();
        final Object obj = Deserializer.deserialize(input, Object.class);
        if (obj instanceof Map) {
            // Before the actual parameters we sometimes (connect) get a map of parameters, this is usually null, but if set should be
            // passed to the connection object.
            @SuppressWarnings("unchecked")
            final Map<String, Object> connParams = (Map<String, Object>) obj;
            notify.setConnectionParams(connParams);
        } else if (obj != null) {
            paramList.add(obj);
        }
        while (in.hasRemaining()) {
            paramList.add(Deserializer.deserialize(input, Object.class));
        }
        params = paramList.toArray();
        if (log.isDebugEnabled()) {
            log.debug("Num params: {}", paramList.size());
            for (int i = 0; i < params.length; i++) {
                log.debug(" > {}: {}", i, params[i]);
            }
        }
        return params;
    }
883824
function (v, paramd) {
    var nd = {};

    var _add = function(v) {
        if (!_.is.String(v)) {
            return false;
        }

        var vmatch = v.match(/^([-a-z0-9]*):.+/);
        if (!vmatch) {
            return false;
        }
        
        var nshort = vmatch[1];
        var nurl = _namespace[nshort];
        if (!nurl) {
            return false;
        }

        nd[nshort] = nurl;

        return true;
    };
    var _walk = function(o) {
        if (_.is.Object(o)) {
            for (var key in o) {
                if (!_add(key)) {
                    continue;
                } else if (!key.match(/^iot/)) {
                    continue;
                } else if (key === "iot:help") {
                    continue;
                }

                var sv = o[key];
                if (_walk(sv)) {
                    nd[key] = {
                        "@id": _ld_expand(key),
                        "@type": "@id"
                    };
                }
            }
        } else if (_.is.Array(o)) {
            var any = false;
            o.map(function(sv) {
                _add(sv);
                any |= _walk(sv);
            });
            return any;
        } else if (_.is.String(o)) {
            if (_add(o)) {
                return true;
            }
        }
    };

    _walk(v);

    if (!v["@context"]) {
        v["@context"] = {};
    }

    _.extend(v["@context"], nd);

    return v;
}
1332471
def p_ParamList(p):
    '''
    
    '''
    if len(p) == 1:
        p[0] = ParamList(None, None)
    elif len(p) == 2:
        p[0] = ParamList(None, p[1])
    else:
        p[0] = ParamList(p[1], p[3])
326448
public synchronized void serializeParameters(ArrayList<String> p) {
    for(Node t : parameters) {
      if(t.param != null) {
        if(t.param instanceof RemainingOptions) {
          for(String str : t.value.split(" ")) {
            if(str.length() > 0) {
              p.add(str);
            }
          }
        }
        else if(t.param instanceof Flag) {
          if(Flag.SET.equals(t.value)) {
            p.add(SerializedParameterization.OPTION_PREFIX + t.param.getOptionID().getName());
          }
        }
        else if(t.value != null && t.value.length() > 0) {
          if(!t.value.startsWith(STRING_USE_DEFAULT) && !STRING_OPTIONAL.equals(t.value)) {
            p.add(SerializedParameterization.OPTION_PREFIX + t.param.getOptionID().getName());
            p.add(t.value);
          }
        }
      }
    }
  }
230402
function getParamAccessor(id, params) {
  // easy access
  var paramGet = function (prop, alt, required) {
    if (arguments.length < 1) {
      throw (new Error('expected at least 1 argument'));
    }
    if (arguments.length < 2) {
      required = true;
    }
    if (params && hasOwnProp(params, prop)) {
      return params[prop];
    }
    if (required) {
      if (!params) {
        throw (new Error('no params supplied for: ' + id));
      }
      throw (new Error('missing param property: ' + prop + ' in: ' + id));
    }
    return alt;
  };
  paramGet.raw = params;
  return paramGet;
}
8914
def inner_avps(name)
      code, _type, _vendor = AVPNames.get(name)

      grouped_value.select { |a| a.code == code }
    end
431452
def set_parameter(self, name, value):
        """"""
        self.lib.tdSetDeviceParameter(self.id, name, str(value))
420858
def _create_and_add_parameters(params):
    '''
    
    '''
    global _current_parameter
    if _is_simple_type(params):
        _current_parameter = SimpleParameter(params)
        _current_option.add_parameter(_current_parameter)
    else:
        # must be a list
        for i in params:
            if _is_simple_type(i):
                _current_parameter = SimpleParameter(i)
            else:
                _current_parameter = TypedParameter()
                _parse_typed_parameter(i)
            _current_option.add_parameter(_current_parameter)
204088
function(src, opt, callback) {
  if (Object.prototype.toString.call(src) !== '[object String]')
    throw new TypeError('First parameter must be a string.');
  src = src.trim();
  var mySplitInput = splitInput(src);

  return mySplitInput ?  {
      meta : yaml.safeLoad(mySplitInput[0]),
      html : marked(mySplitInput[1], opt, callback)
    } : {
      meta : null,
      html : marked(src, opt, callback)
    };
}
1087733
function infer(val, opts) {
  opts = opts || {};

  // Optional custom inference hook.
  if (opts.valueHook) {
    var type = opts.valueHook(val, opts);
    if (type !== undefined) {
      if (!types.Type.isType(type)) {
        throw new Error(f('invalid value hook return value: %j', type));
      }
      return type;
    }
  }

  // Default inference logic.
  switch (typeof val) {
    case 'string':
      return createType('string', opts);
    case 'boolean':
      return createType('boolean', opts);
    case 'number':
      if ((val | 0) === val) {
        return createType('int', opts);
      } else if (Math.abs(val) < 9007199254740991) {
        return createType('float', opts);
      }
      return createType('double', opts);
    case 'object':
      if (val === null) {
        return createType('null', opts);
      } else if (Array.isArray(val)) {
        if (!val.length) {
          return EMPTY_ARRAY_TYPE;
        }
        return createType({
          type: 'array',
          items: combine(val.map(function (v) { return infer(v, opts); }))
        }, opts);
      } else if (Buffer.isBuffer(val)) {
        return createType('bytes', opts);
      }
      var fieldNames = Object.keys(val);
      if (fieldNames.some(function (s) { return !types.isValidName(s); })) {
        // We have to fall back to a map.
        return createType({
          type: 'map',
          values: combine(fieldNames.map(function (s) {
            return infer(val[s], opts);
          }), opts)
        }, opts);
      }
      return createType({
        type: 'record',
        fields: fieldNames.map(function (s) {
          return {name: s, type: infer(val[s], opts)};
        })
      }, opts);
    default:
      throw new Error(f('cannot infer type from: %j', val));
  }
}
953745
private List<Object> reprocessFormParams(Method method, List<Object> origParams, Message m) {
        Form form = null;
        boolean hasFormParamAnnotations = false;
        Object[] newValues = new Object[origParams.size()];
        java.lang.reflect.Parameter[] methodParams = method.getParameters();
        for (int i = 0; i < methodParams.length; i++) {
            if (Form.class.equals(methodParams[i].getType())) {
                form = (Form) origParams.get(i);
            }
            if (methodParams[i].getAnnotation(FormParam.class) != null) {
                hasFormParamAnnotations = true;
            } else {
                newValues[i] = origParams.get(i);
            }
        }

        if (!hasFormParamAnnotations || form == null) {
            return origParams;
        }

        for (int i = 0; i < newValues.length; i++) {
            if (newValues[i] == null) {
                String formFieldName = methodParams[i].getAnnotation(FormParam.class).value();
                List<String> values = form.asMap().get(formFieldName);
                newValues[i] = InjectionUtils.createParameterObject(values, 
                                                                    methodParams[i].getType(),
                                                                    methodParams[i].getParameterizedType(),
                                                                    methodParams[i].getAnnotations(),
                                                                    (String) origParams.get(i),
                                                                    false,
                                                                    ParameterType.FORM,
                                                                    m);
                if (LOG.isLoggable(Level.FINEST)) {
                    LOG.log(Level.FINEST, "replacing @FormParam value of {0} with {1}",
                        new Object[]{origParams.get(i), newValues[i]});
                }
            }
        }
        return Arrays.asList(newValues);
    }
121366
function allowOptionalParams(params, callback) {
    if (!callback) {
        callback = params;
        params = { };
    }
    return {
        params: params,
        callback: callback,
    };
}
1111055
def _textParameterToView(parameter):
    
    if parameter.type == TEXT_INPUT:
        return TextParameterView(parameter)
    if parameter.type == PASSWORD_INPUT:
        return PasswordParameterView(parameter)
    if parameter.type == FORM_INPUT:
        return FormInputParameterView(parameter)
    return None