Parse a single parameter.
776703
function parseParameter(spec, ctx, params) {
  if (!spec || !isObject(spec)) return spec;

  for (var i=0, n=PARSERS.length, p; i<n; ++i) {
    p = PARSERS[i];
    if (spec.hasOwnProperty(p.key)) {
      return p.parse(spec, ctx, params);
    }
  }
  return spec;
}
1270803
def _parse_fail(name, var_type, value, values):
  """"""
  raise ValueError(
      'Could not parse hparam \'%s\' of type \'%s\' with value \'%s\' in %s' %
      (name, var_type.__name__, value, values))
92066
def param(self,key,default=None):
        """"""
        if key in self.parameters:
            return self.parameters[key]
        return default
1216461
def parse_value(self, value):
        """"""
        parsed = super(IntField, self).parse_value(value)
        if parsed is None:
            return parsed
        return int(parsed)
1173162
def p_parse(cls, input, methodname=None, parse_all=True):
        
        if methodname is None:
            methodname = cls.__default__
        p = cls(input)
        result = getattr(p, methodname)()
        if result is cls.NoMatch or parse_all and p.p_peek() is not None:
            p.p_raise()
        return result
86443
def parse(self, input):
        """"""
        query = None
        for handler in self._line_handlers:
            try:
                query = handler.handle(input)
            except Exception as e:
                query = None
            finally:
                if query is not None:
                    return query
        return None
425467
def parse(self, value):
        
        result = {}
        rest = {}
        for k, v in value.iteritems():
            if k in self.fields:
                if (isinstance(v, dict)
                        and not self.fields[k].supports_multiple):
                    if len(v) == 1:
                        # We support "foo.1" as "foo" as long as there is only
                        # one "foo.#" parameter provided.... -_-
                        v = v.values()[0]
                    else:
                        raise InvalidParameterCombinationError(k)
                result[k] = self.fields[k].coerce(v)
            else:
                rest[k] = v
        for k, v in self.fields.iteritems():
            if k not in result:
                result[k] = v.coerce(None)
        if rest:
            raise UnknownParametersError(result, rest)
        return result
560529
def parse_querystring(self, req, name, field):
        """"""
        return get_value(req.query_arguments, name, field)
692723
public static Long parseLong(String param) {
		try {
			if (!StringUtils.isBlank(param)) {
				return Long.valueOf(param);
			}
		} catch (Exception e) {
			throw new IllegalArgumentException("Parameter " + param + " is not a number.");
		}
		return null;
	}
1316416
def get_parameter(self, parameter):
        ""
        parameter = self._get_parameter_name(parameter)
        return self._parameters[parameter]
1104513
def parse_value(cls, value: int, default: T = None) -> T:
        """"""
        return next((item for item in cls if value == item.value), default)
676469
def _parse_value(self):
        """"""
        indent = 0
        while self._cur_token['type'] is TT.ws:
            indent = self._skip_whitespace()
            self._skip_newlines()

        if self._cur_token['type'] is TT.id:
            return self._parse_key(indent)
        elif self._cur_token['type'] is TT.hyphen:
            self._increment()
            if self._cur_token['type'] is TT.hyphen:
                self._increment()
                return []
            else:
                return self._parse_object_list()
        else:
            # TODO: single comma gives empty list
            return self._parse_literal_list(indent)
433200
def parse(cls, buff, offset):
        
        size, offset = cls.size_primitive.parse(buff, offset)
        if size == -1:
            return None, offset

        var_struct = struct.Struct("!%ds" % size)

        value = var_struct.unpack_from(buff, offset)[0]
        value = cls.parse_value(value)
        offset += var_struct.size

        return value, offset
1262177
def _parse(args):
    """"""

    ordered = []
    opt_full = dict()
    opt_abbrev = dict()

    args = args + ['']  # Avoid out of range
    i = 0

    while i < len(args) - 1:
        arg = args[i]
        arg_next = args[i+1]
        if arg.startswith('--'):
            if arg_next.startswith('-'):
                raise ValueError('{} lacks value'.format(arg))
            else:
                opt_full[arg[2:]] = arg_next
                i += 2
        elif arg.startswith('-'):
            if arg_next.startswith('-'):
                raise ValueError('{} lacks value'.format(arg))
            else:
                opt_abbrev[arg[1:]] = arg_next
                i += 2
        else:
            ordered.append(arg)
            i += 1
    
    return ordered, opt_full, opt_abbrev
465702
def parse_value(self, value):
        """"""
        if isinstance(value, datetime.datetime):
            return value
        if value:
            return parse(value)
        else:
            return None
1148368
def gather_parameters(self, request, response, context, api_version=None, **input_parameters):
        """"""
        input_parameters.update(request.params)

        if self.parse_body and request.content_length:
            body = request.stream
            content_type, content_params = parse_content_type(request.content_type)
            body_formatter = body and self.inputs.get(content_type, self.api.http.input_format(content_type))
            if body_formatter:
                body = body_formatter(body, content_length=request.content_length, **content_params)
            if 'body' in self.all_parameters:
                input_parameters['body'] = body
            if isinstance(body, dict):
                input_parameters.update(body)
        elif 'body' in self.all_parameters:
            input_parameters['body'] = None

        if 'request' in self.all_parameters:
            input_parameters['request'] = request
        if 'response' in self.all_parameters:
            input_parameters['response'] = response
        if 'api_version' in self.all_parameters:
            input_parameters['api_version'] = api_version
        for parameter, directive in self.directives.items():
            arguments = (self.defaults[parameter], ) if parameter in self.defaults else ()
            input_parameters[parameter] = directive(*arguments, response=response, request=request,
                                                    api=self.api, api_version=api_version, context=context,
                                                    interface=self)
        return input_parameters
879351
def parse_value(key, value):
    """"""
    default = OPTIONS.get(key)
    if isinstance(default, collections.Iterable):
        if not isinstance(default, six.string_types):
            return [item.strip()
                    for item in value.split(',')]
    return value