Translates arg to enforce proper assignment
12871
def mode_assignment(arg):
    
    arg = arg.upper()
    stream_args = ('STREAM', 'CONSOLE', 'STDOUT')
    try:
        if arg in stream_args:
            return 'STREAM'
        else:
            return arg
    except Exception:
        return None
807744
function checkForUnknownArguments(yargs, argv, command) {
	const aliasLookup = {};
	const flags = yargs.getOptions().key;
	const demanded = yargs.getDemanded();
	const unknown = [];

	Object.keys(yargs.parsed.aliases || {}).forEach((key) => {
		yargs.parsed.aliases[key].forEach((alias) => {
			aliasLookup[alias] = key;
		});
	});

	function isUnknown(key) {
		return (key !== '$0' && key !== '_' && key !== 'params' &&
			!demanded.hasOwnProperty(key) &&
			!flags.hasOwnProperty(key) &&
			!aliasLookup.hasOwnProperty('no-' + key) &&
			!aliasLookup.hasOwnProperty(key));
	}

	function aliasFor(key) {
		return command.unaliasOption(key);
	}

	Object.keys(argv).forEach((key) => {
		const alias = aliasFor(key);
		if (isUnknown(key) && (!alias || isUnknown(alias))) {
			unknown.push(key);
		}
	});

	if (unknown.length) {
		throw unknownArgumentError(unknown);
	}
}
44504
def construct(args):
    ''''''
    # make everything unicode
    name = u''
    delimiter, encodeseq = delimiter_encodeseq(_c.FSQ_DELIMITER,
                                               _c.FSQ_ENCODE, _c.FSQ_CHARSET)
    if len(args) == 0:
        return delimiter
    for arg in args:
        name = delimiter.join([ name,
                                encode(coerce_unicode(arg, _c.FSQ_CHARSET),
                                delimiter=delimiter, encodeseq=encodeseq)])

    return name
745282
def assign(name, value):
    '''
    
    '''
    value = six.text_type(value)

    if six.PY3:
        tran_tab = name.translate(''.maketrans('./', '/.'))
    else:
        if isinstance(name, unicode):  # pylint: disable=incompatible-py3-code,undefined-variable
            trans_args = {ord('/'): u'.', ord('.'): u'/'}
        else:
            trans_args = string.maketrans('./', '/.')
        tran_tab = name.translate(trans_args)

    sysctl_file = '/proc/sys/{0}'.format(tran_tab)
    if not os.path.exists(sysctl_file):
        raise CommandExecutionError('sysctl {0} does not exist'.format(name))

    ret = {}
    cmd = 'sysctl -w {0}="{1}"'.format(name, value)
    data = __salt__['cmd.run_all'](cmd, python_shell=False)
    out = data['stdout']
    err = data['stderr']

    # Example:
    #    # sysctl -w net.ipv4.tcp_rmem="4096 87380 16777216"
    #    net.ipv4.tcp_rmem = 4096 87380 16777216
    regex = re.compile(r'^{0}\s+=\s+{1}$'.format(re.escape(name), re.escape(value)))

    if not regex.match(out) or 'Invalid argument' in six.text_type(err):
        if data['retcode'] != 0 and err:
            error = err
        else:
            error = out
        raise CommandExecutionError('sysctl -w failed: {0}'.format(error))
    new_name, new_value = out.split(' = ', 1)
    ret[new_name] = new_value
    return ret
355251
function ( obj, arg ) {
		array.each( arg.replace( /\]$/, "" ).replace( /\]/g, "." ).replace( /\.\./g, "." ).split( /\.|\[/ ), function ( i ) {
			obj = obj[i];
		});

		return obj;
	}
956352
def translated(self, value, type):
        
        if value is not None:
            resolved = type.resolve()
            return resolved.translate(value)
        else:
            return value
1276354
function(language, patterns, bypass) {

            // if there is only one argument then we assume that we want to
            // extend the default language rules
            if (arguments.length == 1) {
                patterns = language;
                language = DEFAULT_LANGUAGE;
            }

            bypass_defaults[language] = bypass;
            language_patterns[language] = patterns.concat(language_patterns[language] || []);
        }
840089
def detect(args):
  
  for l in args.input:
    if l.strip():
      _print("{:<20}{}".format(Detector(l).language.name, l.strip()))
780077
def _ensure_5args(func):
    
    if func is None:
        return None

    self_arg = 1 if inspect.ismethod(func) else 0
    if len(inspect.getargspec(func)[0]) == 5 + self_arg:
        return func
    if len(inspect.getargspec(func)[0]) == 4 + self_arg:
        return lambda t, y, J, dfdt, fy=None: func(t, y, J, dfdt)
    else:
        raise ValueError("Incorrect numer of arguments")
954110
function translate() {      // v, obj or array
   var a = arguments, v = a[0], o, i = 1;
   if(a[1].length) { a = a[1]; i = 0; }
   for(o=a[i++]; i<a.length; i++) { 
      o = o.union(a[i]);
   } 
   return o.translate(v); 
}
598424
function (arg) {
						if ( ! arg.allow ){
							return;
						}

						var exist = false;
						for (var i in data.allow) {
							if (data.allow[i] === arg.allow) {
								exist = true;
							}
						}
						if ( exist === false ) {
							data.allow[data.allow.length] = arg.allow;
						}
					}
200104
def kwargs_as_assignments(call_node, parent):
    """"""
    if not isinstance(call_node, ast.Call):
        raise TypeError('node must be an ast.Call')

    if len(call_node.args) > 0:
        raise ValueError('positional args not allowed')

    for keyword in call_node.keywords:
        dst_name = keyword.arg

        if dst_name.startswith('gl_'):
            # Write to builtins directly
            target = [ast.Name(id=keyword.arg, ctx=ast.Load())]
        else:
            # Non-builtins are part of an interface block
            target = [ast.Attribute(value=parent, attr=keyword.arg,
                                    ctx=ast.Store())]

        yield NoDeclAssign(targets=target, value=keyword.value)
590586
function normalizeArgs (args) {
  var path, schema, options, callback;
  args = Array.prototype.slice.call(args);

  if (typeof args[args.length - 1] === "function") {
    // The last parameter is a callback function
    callback = args.pop();
  }

  if (typeof args[0] === "string") {
    // The first parameter is the path
    path = args[0];
    if (typeof args[2] === "object") {
      // The second parameter is the schema, and the third parameter is the options
      schema = args[1];
      options = args[2];
    }
    else {
      // The second parameter is the options
      schema = undefined;
      options = args[1];
    }
  }
  else {
    // The first parameter is the schema
    path = "";
    schema = args[0];
    options = args[1];
  }

  if (!(options instanceof Options)) {
    options = new Options(options);
  }

  return {
    path: path,
    schema: schema,
    options: options,
    callback: callback
  };
}
1199435
function invariant(condition, msg, ...args) {
  if (!condition) {
    throw new Error(util.format(msg, ...args));
  }
}
435427
private Context translateAssert(WyilFile.Stmt.Assert stmt, Context context) {
		Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
		Expr condition = p.first();
		context = p.second();
		//
		VerificationCondition verificationCondition = new VerificationCondition("assertion failed", context.assumptions,
				condition, stmt.getCondition().getParent(WyilFile.Attribute.Span.class));
		context.emit(verificationCondition);
		//
		return context.assume(condition);
	}
502504
def set_argument(bound_args, address, value):
    
    if address.kind == ArgumentKind.regular:
        bound_args.arguments[address.name] = value
        return

    if address.kind == ArgumentKind.variadic:
        if address.name not in bound_args.arguments:
            bound_args.arguments[address.name] = []

        n_args = len(bound_args.arguments[address.name])
        if address.key >= n_args:
            bound_args.arguments[address.name].extend(
                repeat(Empty, address.key - n_args + 1))

    if address.kind == ArgumentKind.keyword:
        if address.name not in bound_args.arguments:
            bound_args.arguments[address.name] = {}

    bound_args.arguments[address.name][address.key] = value
973588
def prepare_arg(value):
    
    if value is None:
        return value
    elif isinstance(value, (list, dict)) or hasattr(value, 'to_python'):
        return json.dumps(_normalize(value))
    elif isinstance(value, datetime.timedelta):
        now = datetime.datetime.now()
        return int((now + value).timestamp())
    elif isinstance(value, datetime.datetime):
        return round(value.timestamp())
    elif isinstance(value, LazyProxy):
        return str(value)
    return value