Check the environment variable and the given argument parameter to decide if aggregations needed.

        argument value is expected to be '0' or '1'
322414
def should_aggregate(self, req):
        
        try:
            return self.app.config.get('ELASTICSEARCH_AUTO_AGGREGATIONS') or \
                   bool(req.args and int(req.args.get('aggregations')))
        except (AttributeError, TypeError):
            return False
388677
def check_arguments(cls, passed):
        """"""
        defaults = list(cls.default_arguments().keys())
        template = ("Pass arg {argument:!r} in {cname:!r}, can be a typo? "
                    "Supported key arguments: {defaults}")
        fails = []
        for arg in passed:
            if arg not in defaults:
                warn(template.format(argument=arg,
                                     cname=cls.__name__,
                                     defaults=defaults))
                fails.append(arg)

        return any(fails)
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);
	}
}
410210
function knParseEnv(envvar)
{
	if (envvar === undefined)
		envvar = knSourcesEnvVar;

	if (!process.env[envvar])
		return ([]);

	return (knParseSources(process.env[envvar]));
}
1287859
function envFromArgs(args) {
	if (!args) return 'prod';
	const envIndex = args.indexOf('--env');
	const devIndex = args.indexOf('dev');
	if (envIndex === devIndex - 1) return 'dev';
	return 'prod';
}
203777
function checkForUnknownArguments (yargs, argv) {
    var aliasLookup = {};
    var descriptions = yargs.getUsageInstance().getDescriptions();
    var demanded = yargs.getDemanded();
    var unknown = [];

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

    Object.keys(argv).forEach(function (key) {
        if (key !== '$0' && key !== '_' && key !== 'params' &&
            !descriptions.hasOwnProperty(key) &&
            !demanded.hasOwnProperty(key) &&
            !aliasLookup.hasOwnProperty('no-' + key) &&
            !aliasLookup.hasOwnProperty(key)) {
                unknown.push(key);
        }
    });

    if (unknown.length === 1) {
        throw Cli.usageError('Unknown argument: ' + unknown[0]);
    } else if (unknown.length > 1) {
        throw Cli.usageError('Unknown arguments: ' + unknown.join(', '));
    }
}
973155
def _check_argument_units(args, dimensionality):
    """"""
    for arg, val in args.items():
        # Get the needed dimensionality (for printing) as well as cached, parsed version
        # for this argument.
        try:
            need, parsed = dimensionality[arg]
        except KeyError:
            # Argument did not have units specified in decorator
            continue

        # See if the value passed in is appropriate
        try:
            if val.dimensionality != parsed:
                yield arg, val.units, need
        # No dimensionality
        except AttributeError:
            # If this argument is dimensionless, don't worry
            if parsed != '':
                yield arg, 'none', need
983166
function parseArgs(argv) {
  debug('parseArgs argv: ', argv);

  // default action
  var action = 'deploy';
  if ( argv['_'].length >= 1 ) {
    action = argv['_'][0];
  }

  failIfEmpty('e', 'environment', argv);
  failIfAbsent('e', 'environment', argv);
  if ('s' in argv || 'stacks' in argv) failIfEmpty('s', 'stacks', argv);
  return {
    environment: argv['e'] || argv['environment'],
    extraVars: parseExtraVars(argv['x'] || argv['extraVars']),
    action: action,
    region: argv['r'] || argv['region'],
    profile: argv['p'],
    cfg: argv['c'] || argv['config'],
    stackFilters: argv['s'] || argv['stacks'] || undefined
  };
}
36318
def validate(**vkargs):
    
    depr('Use route wildcard filters instead.')
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kargs):
            for key, value in vkargs.items():
                if key not in kargs:
                    abort(403, 'Missing parameter: %s' % key)
                try:
                    kargs[key] = value(kargs[key])
                except ValueError:
                    abort(403, 'Wrong parameter format for: %s' % key)
            return func(*args, **kargs)
        return wrapper
    return decorator
765939
function checkArgument(i) {
  let l;

  if (l = checkBrackets(i)) tokens[i].argument_child = 1;
  else if (l = checkParentheses(i)) tokens[i].argument_child = 2;
  else if (l = checkSingleValueDeclaration(i)) tokens[i].argument_child = 3;
  else if (l = checkFunctionsList(i)) tokens[i].argument_child = 4;
  else if (l = checkFunction(i)) tokens[i].argument_child = 5;
  else if (l = checkVariablesList(i)) tokens[i].argument_child = 6;
  else if (l = checkVariable(i)) tokens[i].argument_child = 7;
  else if (l = checkSC(i)) tokens[i].argument_child = 8;
  else if (l = checkDelim(i)) tokens[i].argument_child = 9;
  else if (l = checkDeclDelim(i)) tokens[i].argument_child = 10;
  else if (l = checkString(i)) tokens[i].argument_child = 11;
  else if (l = checkPercentage(i)) tokens[i].argument_child = 12;
  else if (l = checkDimension(i)) tokens[i].argument_child = 13;
  else if (l = checkNumber(i)) tokens[i].argument_child = 14;
  else if (l = checkUri(i)) tokens[i].argument_child = 15;
  else if (l = checkInterpolation(i)) tokens[i].argument_child = 16;
  else if (l = checkIdent(i)) tokens[i].argument_child = 17;
  else if (l = checkVhash(i)) tokens[i].argument_child = 18;
  else if (l = checkCustomProperty(i)) tokens[i].argument_child = 19;
  else if (l = checkOperator(i)) tokens[i].argument_child = 20;
  else if (l = checkUnary(i)) tokens[i].argument_child = 21;
  else if (l = checkParentSelector(i)) tokens[i].argument_child = 22;
  else if (l = checkImportant(i)) tokens[i].argument_child = 23;
  else if (l = checkGlobal(i)) tokens[i].argument_child = 24;
  else if (l = checkDefault(i)) tokens[i].argument_child = 25;
  else if (l = checkOptional(i)) tokens[i].argument_child = 26;

  return l;
}
839008
def args_to_int(mapping, argument):
    
    if isinstance(argument, int):
        if argument == 0:
            return 0
        deprecation('passing extensions and flags as constants is deprecated')
        return argument
    elif isinstance(argument, (tuple, list)):
        return reduce(op.or_, [mapping[n] for n in set(argument) if n in mapping], 0)
    raise TypeError('argument must be a list of strings or an int')
959515
def aggregate(args):
    

    _ok_to_clobber(args, [args.output_filename[0]], "")
    logger.debug("Aggregating to {}".format(args.output_filename[0]))

    from astropy.table import Table

    # What header keys should be passed to the final table?
    header_keys = ["RA", "DEC", "NAME", "OBJECT", "MAGNITUDE",
        "UTSTART", "UTEND", "UTDATE", "V_HELIO", "V_BARY"]

    def load_result_file(filename, debug):
        
        loader = yaml.load if filename.lower().endswith(".yaml") else pickle.load
        with open(filename, "r") as fp:
            try:
                result = loader(fp)
            
            except:
                logger.exception("Could not read results filename: {}".format(
                    filename))
                if debug: raise

            else:
                logger.debug("Successfully loaded results from {}".format(
                    filename))
        return result

    # Dows the first result actually exist, or is it a wildname mask?
    if not os.path.exists(args.result_filenames[0]):
        args.result_filenames = glob(args.result_filenames[0])

    # Load the first set of results to get the parameter names.
    first_results = load_result_file(args.result_filenames[0], True)
    parameters = set(first_results["estimated"]["theta"].keys() \
        + first_results.get("optimised", {}).get("theta", {}).keys() \
        + first_results.get("inferred", {}).get("theta", {}).keys())

    # Grab headers that exist.
    header_keys = [k for k in header_keys if k in first_results["headers"]]

    def default_values(stage):
        keys = "chi_sq dof r_chi_sq".split()
        default = dict(zip(["{0}_{1}".format(stage, key) for key in keys],
            [np.nan] * len(keys)))
        default["theta"] = dict(zip(
            ["{0}_{1}".format(stage, parameter) for parameter in parameters],
            [np.nan] * len(parameters)))
        return default

    def extract_values(result, stage, parameter_prefixes=None):
        _ = {
            "{}_chi_sq".format(stage): result.get("chi_sq", np.nan),
            "{}_dof".format(stage): result.get("dof", np.nan),
            "{}_r_chi_sq".format(stage): result.get("r_chi_sq", np.nan)
        }
        _.update(dict(zip(
            ["{0}_{1}".format(stage, parameter) for parameter in parameters],
            [result["theta"].get(param, np.nan) for param in parameters])))

        if parameter_prefixes is not None:
            for prefix in parameter_prefixes:
                _.update(dict(zip(
                    ["_".join([stage, prefix, parameter]) \
                        for parameter in parameters],
                    [result.get("{0}_{1}".format(prefix, parameter), np.nan) \
                        for parameter in parameters])))
        return _

    rows = []
    columns = [] + header_keys + ["SNR", "model", "sick_version", "results_filename"]
    for i, filename in enumerate(args.result_filenames):

        result = load_result_file(filename, debug=args.debug)
        logger.debug("Loaded results from {}".format(filename))

        # Header information.
        row = dict(zip(header_keys,
            [result["headers"].get(k, None) for k in header_keys]))
        row.update({
            "model": result["model"],
            "sick_version": result["sick_version"],
            "results_filename": filename,
            "SNR": result["SNR"]
        })
        
        # Include estimated values (which should always be present)
        estimated = extract_values(result["estimated"], "estimated")
        row.update(estimated)
        
        # Include optimised values, if they exist.
        optimised = extract_values(
            result.get("optimised", default_values("optimised")), "optimised")
        row.update(optimised)

        # Include inferred values, if they exist.
        inferred = extract_values(
            result.get("inferred", default_values("inferred")), "inferred",
            parameter_prefixes=["u_pos", "u_neg", "n_eff"])
        row.update(inferred)
        rows.append(row)

    for each in (estimated, optimised, inferred):
        columns += sorted(each.keys())

    table = Table(rows=rows, names=columns)
    try:
        table.write(args.output_filename[0], overwrite=args.clobber)
    except TypeError:
        table.write(args.output_filename[0])
        logger.info("Results from {0} files aggregated and saved to {1}".format(
            len(args.result_filenames), args.output_filename[0]))
1136564
def _raise_check_aggregation(aggregation: str):
        
        if aggregation not in ComputeStats.EXTRA_AGGREGATIONS and not hasattr(np, aggregation):
            raise ValueError('Aggregation `{}` is not a NumPy function or a member '
                             'of EXTRA_AGGREGATIONS.'.format(aggregation))
993738
def has_argument(arg, arguments):
    
    try:
        if not isinstance(arguments, list):
            arguments = arguments.__arguments__
        for idx, (args, kwargs) in enumerate(arguments):
            arg_name = kwargs.get(
                'dest', args[-1].lstrip('-').replace('-', '_'))
            if arg_name == arg:
                return idx
        idx = False
    except (ValueError, AttributeError):
        idx = False
    return idx
104645
function (aggregate, cmd) {
    if (!aggregate || !_.isObject(aggregate)) {
      var err = new Error('Please pass a valid aggregate!');
      debug(err);
      throw err;
    }
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }

    var reason = this.isAggregateDestroyed(aggregate, cmd);
    if (reason) {
      return reason;
    }

    if (this.aggregate.disablePersistence) return;

    reason = this.isRevisionWrong(aggregate, cmd);
    if (reason) {
      return reason;
    }
  }
774468
def _resolve_args(self, env, args):
        
        pos_args, kw_args = args

        def check_value(v):
            if isinstance(v, AstTypeRef):
                return self._resolve_type(env, v)
            else:
                return v

        new_pos_args = [check_value(pos_arg) for pos_arg in pos_args]
        new_kw_args = {k: check_value(v) for k, v in kw_args.items()}
        return new_pos_args, new_kw_args
670042
function checkArgs(args) {
  if (args.length !== 2) {
    console.warn(`WWWW Checking claudia args: args.length !== 2, is: ${args.length}`, inspect({args}));
  }
}