Extract singular arguments; will take first if multiple.
335592
function _param(req, param, pdefault){

    var ret = null;

    // Try the route parameter space.
    if( req && req.params && typeof(req.params[param]) !== 'undefined' ){
	ret = req.params[param];
    }

    // Try the get space.
    if( ! ret ){

	if( req && req.query && req.query[param] && typeof(req.query[param]) !== 'undefined' ){
	    ret = req.query[param];
	}
    }

    // Otherwise, try the body space.
    if( ! ret ){

	var decoded_body = req.body || {};
	if( decoded_body && ! us.isEmpty(decoded_body) && decoded_body[param] ){
	    ret = decoded_body[param];
	}
    }

    // Reduce to first if array.
    if( us.isArray(ret) ){
	if( ret.length === 0 ){
	    ret = pdefault;
	}else{
	    ret = ret[0];
	}
    }

    // Finally, default.
    if( ! ret ){
	ret = pdefault;
    }

    return ret;
}
319138
def args_as_tuple(self):
        """"""
        if "," in self.arguments["header-names"]:
            result = tuple(tools.to_list(self.arguments["header-names"]))
        else:
            result = (self.arguments["header-names"].strip('"'),)
        result = result + (self.arguments["match-type"],)
        if "," in self.arguments["key-list"]:
            result = result + tuple(
                tools.to_list(self.arguments["key-list"], unquote=False))
        else:
            result = result + (self.arguments["key-list"].strip('"'),)
        return result
1235922
private static ParsedLine extractCommandArguments(final ParsedLine line) {
    // copy the list, so we can mutate and pop the first item off
    LinkedList<String> words = Lists.newLinkedList(line.words());
    String remove = words.pop();
    String rawLine = line.line();

    // rebuild that list sans the first argument
    if (remove.length() > rawLine.length()) {
      return new DefaultParser.ArgumentList(
        rawLine.substring(remove.length() + 1, rawLine.length()),
        words,
        line.wordIndex() - 1,
        line.wordCursor(),
        line.cursor() - remove.length() + 1
      );
    }
    else {
      return new DefaultParser.ArgumentList("", Collections.emptyList(), 0, 0, 0);
    }
  }
154146
function extractKwargs(args) {
    var last = args[args.length - 1];
    return (is.object(last) && last.__keywords)? args.pop() : {};
}
335674
def pluralize(singular):
    
    if singular in UNCOUNTABLES:
        return singular
    for i in IRREGULAR:
        if i[0] == singular:
            return i[1]
    for i in PLURALIZE_PATTERNS:
        if re.search(i[0], singular):
            return re.sub(i[0], i[1], singular)
111647
def extract_opts(**opts):
    
    values = {}
    for opt, init in opts.items():
        try:
            idx = sys.argv.index('-%s' % opt)
        except ValueError:
            continue
        if idx+1 < len(sys.argv):
            opts[opt] = sys.argv.pop(idx+1)

        sys.argv.pop(idx)

    return opts
726581
def extract_endpoint_arguments(endpoint):
    """"""

    ep_args = endpoint._arguments
    if ep_args is None:
        return None

    arg_docs = { k: format_endpoint_argument_doc(a) \
            for k, a in ep_args.iteritems() }
    return arg_docs
984933
def param_extract(args, short_form, long_form, default=None):
    
    val = default
    for i, a in enumerate(args):
        # Long form may use "--xyz=foo", so need to split on '=', but it
        # doesn't necessarily do that, can also be "--xyz foo".
        elems = a.split("=", 1)
        if elems[0] in [short_form, long_form]:
            # At least make sure that an actual name was specified
            if len(elems) == 1:
                if i + 1 < len(args) and not args[i + 1].startswith("-"):
                    val = args[i + 1]
                else:
                    val = ""  # Invalid value was specified
            else:
                val = elems[1]
            break

    return val
812787
function extractLiterals(stats, args) {
    if (stats.getType() != null && (stats.getType() === "installed" || stats.getType() === "builtin")) {
        extractLiteralFromInstalled(stats, args);
    }

    if (stats.getType() != null && stats.getType() === "def") {
        extractLiteralFromDef(stats, args[0]);
    }

    if (stats.getType() != null && (stats.getType() === "main" || stats.getType() === "remap")) {
        extractLiteralFromMain(stats, args[0]);
    }
}
775726
function parseArguments$3(args) {
        var first = args[0];
        var second = args[1];

        return typeof first === 'string' ? { namespace: first, mappings: second } : { namespace: null, mappings: first };
    }
1197335
def singularize(plural):
    
    if plural in UNCOUNTABLES:
        return plural
    for i in IRREGULAR:
        if i[1] == plural:
            return i[0]
    for i in SINGULARIZE_PATTERNS:
        if re.search(i[0], plural):
            return re.sub(i[0], i[1], plural)
    return plural
28243
def articles(self):
		'''  '''

		result = [None, None]
		element = self._first('NN')
		if element:
			element = element.split('\r\n')[0]
			if ' | ' in element:
				# This means there is a plural
				singular, plural = element.split(' | ')
				singular, plural = singular.strip(), plural.strip()
			else:
				# This means there is no plural
				singular, plural = element.strip(), ''
				result[1] = ''
			if singular:
				result[0] = singular.split(' ')[0].split('/')
			if plural:
				result[1] = plural.split(' ')[0].split('/')
		return result
288858
def each_arg(args)
			remains = []
			i = 0

			until i >= args.length
				return remains += args[i..-1] if @stop_words.member? args[i]
				case args[i]
				when /^--$/ # arg terminator
					return remains += args[(i + 1)..-1]
				when /^--(\S+?)=(.*)$/ # long argument with equals
					num_params_taken = yield "--#{$1}", [$2]
					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					end
					i += 1
				when /^--(\S+)$/ # long argument
					params = collect_argument_parameters(args, i + 1)
					num_params_taken = yield args[i], params

					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					else
						i += num_params_taken
					end
					i += 1
				when /^-(\S+)$/ # one or more short arguments
					short_remaining = ""
					shortargs = $1.split(//)
					shortargs.each_with_index do |a, j|
						if j == (shortargs.length - 1)
							params = collect_argument_parameters(args, i + 1)

							num_params_taken = yield "-#{a}", params
							unless num_params_taken
								short_remaining << a
								if @stop_on_unknown
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							else
								i += num_params_taken
							end
						else
							unless yield "-#{a}", []
								short_remaining << a
								if @stop_on_unknown
									short_remaining += shortargs[j + 1..-1].join
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							end
						end
					end

					unless short_remaining.empty?
						remains << "-#{short_remaining}"
					end
					i += 1
				else
					if @stop_on_unknown
						return remains += args[i..-1]
					else
						remains << args[i]
						i += 1
					end
				end
			end

			remains
		end
1056131
def getargtxt(obj, one_arg_per_line=True):
    
    args = getargs(obj)
    if args:
        sep = ', '
        textlist = None
        for i_arg, arg in enumerate(args):
            if textlist is None:
                textlist = ['']
            textlist[-1] += arg
            if i_arg < len(args)-1:
                textlist[-1] += sep
                if len(textlist[-1]) >= 32 or one_arg_per_line:
                    textlist.append('')
        if inspect.isclass(obj) or inspect.ismethod(obj):
            if len(textlist) == 1:
                return None
            if 'self'+sep in textlist:
                textlist.remove('self'+sep)
        return textlist
43656
def split_args(args):
    
    args_dict = {}
    for arg in args:
        split_arg = arg.split('=', 1)
        if len(split_arg) > 1:
            value = split_arg[1]
        else:
            value = True
        args_dict[split_arg[0]] = value
    return args_dict
709990
def p_args(self, p):
        """"""
        if len(p) > 3:
            if p[3] == ',':
                p[0] = (p[2], p[4])
            elif isinstance(p[2], dict):
                p[0] = ([], p[2])
            else:
                p[0] = (p[2], {})
        else:
            p[0] = ([], {})
1350666
def parse_singular_string(t, tag_name):
    ''''''
    pos = t.getElementsByTagName(tag_name)
    assert(len(pos) == 1)
    pos = pos[0]
    assert(len(pos.childNodes) == 1)
    return pos.childNodes[0].data