Check if passed-in arguments are valid for a specific format
322158
def valid_args?(accepted_arg_formats)
      valid_args = false

      accepted_arg_formats.each { |format|
        # if no arguments exist, and no arguments is an accepted format, args are valid.
        if format.empty? && @current_args.empty?
          valid_args = true
        else
          passed_in_args = @current_args.clone

          format.each_with_index { |arg, i|
            passed_in_args[i] = arg if CMD_BLACKLIST.include?(arg)
          }

          @invalid_args = passed_in_args - format - [nil]

          valid_args = true if passed_in_args == format
        end
      }

      valid_args
    end
322201
def format_parameters(params):
    ''''''

    if not params:
        return {}

    # expect multiple invocations of --parameters but fall back
    # to ; delimited if only one --parameters is specified
    if len(params) == 1:
        if params[0].find(';') != -1:  # found
            params = params[0].split(';')
        else:
            params = params[0].split(',')

    parameters = {}
    for p in params:
        try:
            (n, v) = p.split('=', 1)
        except ValueError:
            msg = '%s(%s). %s.' % ('Malformed parameter', p,
                                   'Use the key=value format')
            raise exc.CommandError(msg)

        if n not in parameters:
            parameters[n] = v
        else:
            if not isinstance(parameters[n], list):
                parameters[n] = [parameters[n]]
            parameters[n].append(v)

    return parameters
1343097
def check_arguments(params, *args)
      contains = true
      args.each do |arg|
        contains = false unless params.key? arg.to_sym
      end
      contains
    end
1244128
def validate_conversion_arguments(to_wrap):
    

    @functools.wraps(to_wrap)
    def wrapper(*args, **kwargs):
        _assert_one_val(*args, **kwargs)
        if kwargs:
            _validate_supported_kwarg(kwargs)

        if len(args) == 0 and "primitive" not in kwargs:
            _assert_hexstr_or_text_kwarg_is_text_type(**kwargs)
        return to_wrap(*args, **kwargs)

    return wrapper
406471
def _check_args(self, source):
        '''
        '''
        path = [source]
        args = self.parsed_yaml.get('args', {})
        self._assert_struct_type(args, 'args', (dict, list), path)
        path.append('args')
        if isinstance(args, dict):
            for argn, argattrs in args.items():
                self._check_one_arg(path, argn, argattrs)
        else: # must be list - already asserted struct type
            for argdict in args:
                self._assert_command_dict(argdict, '[list-item]', path)
                argn, argattrs = list(argdict.items())[0] # safe - length asserted on previous line
                self._check_one_arg(path, argn, argattrs)
1128763
function validateParams(fs, param2) {
  var err;

  if(!fs) {
    err = new Errors.EINVAL('No filesystem provided');
  } else if(!param2) {
    err = new Errors.EINVAL('Second argument must be specified');
  }

  return err;
}
717663
function isValidForRegexLiteral(context: ParserContext): boolean {
  const previousNonWsToken = context.token(context.count() - 1);

  // Valid if at the beginning of the file.
  if (!previousNonWsToken) return true;

  return (
    !util.contains(
      ["keyword", "ident", "number", "variable", "specialVariable"],
      previousNonWsToken.name
    ) &&
    !(
      previousNonWsToken.name === "punctuation" &&
      !util.contains(["(", "{", "[", ",", ";"], previousNonWsToken.value)
    )
  );
}
955736
def __check_for_extra_arguments(self, args_required, args_allowed):
        
        assert not self.active()
        if not self.__extra_parameter_errors:
            return

        if self.__kwargs:
            param_name = self.__kwargs.keys()[0]
            if param_name in self.__params_with_arguments:
                msg = "got multiple values for parameter '%s'"
            else:
                msg = "got an unexpected keyword argument '%s'"
            self.__error(msg % (param_name,))

        if self.__args:
            def plural_suffix(count):
                if count == 1:
                    return ""
                return "s"
            def plural_was_were(count):
                if count == 1:
                    return "was"
                return "were"
            expected = args_required
            if args_required != args_allowed:
                expected = "%d to %d" % (args_required, args_allowed)
            given = self.__args_count
            msg_parts = ["takes %s positional argument" % (expected,),
                plural_suffix(expected), " but %d " % (given,),
                plural_was_were(given), " given"]
            self.__error("".join(msg_parts))
650088
def assert_valid_arguments(func, *args, **kwargs):
    
    # get the function argspec
    argspec = getargspec(func)

    func_defaults = argspec.defaults or tuple()
    defaults = (Required,) * (len(argspec.args) - len(func_defaults)) + func_defaults
    for index, arg_name in enumerate(argspec.args):
        arg_value = args[index] if index < len(args) else kwargs.get(arg_name)
        if arg_value is not None:
            continue
        if defaults[index] is not Required:
            continue
        abort("Missing required argument: {}".format(arg_name))
781079
def _format_args():
    """"""
    # Ensure we can run outside a application/request context.
    try:
        pretty_format = \
            current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and \
            not request.is_xhr
    except RuntimeError:
        pretty_format = False

    if pretty_format:
        return dict(
            indent=2,
            separators=(', ', ': '),
        )
    else:
        return dict(
            indent=None,
            separators=(',', ':'),
        )
55144
def determine_file_extension_based_on_format(format_specifier):
	
	if format_specifier == FMT_INI:
		return 'ini'
	if format_specifier == FMT_DELIMITED:
		return ''
	if format_specifier == FMT_XML:
		return 'xml'
	if format_specifier == FMT_JSON:
		return 'json'
	if format_specifier == FMT_YAML:
		return 'yml'
	raise ValueError('invalid format specifier: {}'.format(format_specifier))
1146779
def _validateGenericParameters(blank, strip, allowlistRegexes, blocklistRegexes):
    """"""

    # Check blank parameter.
    if not isinstance(blank, bool):
        raise PySimpleValidateException('blank argument must be a bool')

    # Check strip parameter.
    if not isinstance(strip, (bool, str, type(None))):
        raise PySimpleValidateException('strip argument must be a bool, None, or str')

    # Check allowlistRegexes parameter (including each regex in it).
    if allowlistRegexes is None:
        allowlistRegexes = [] # allowlistRegexes defaults to a blank list.

    try:
        len(allowlistRegexes) # Make sure allowlistRegexes is a sequence.
    except:
        raise PySimpleValidateException('allowlistRegexes must be a sequence of regex_strs')
    for response in allowlistRegexes:
        if not isinstance(response[0], str):
            raise PySimpleValidateException('allowlistRegexes must be a sequence of regex_strs')

    # Check allowlistRegexes parameter (including each regex in it).
    # NOTE: blocklistRegexes is NOT the same format as allowlistRegex, it can
    # include an "invalid input reason" string to display if the input matches
    # the blocklist regex.
    if blocklistRegexes is None:
        blocklistRegexes = [] # blocklistRegexes defaults to a blank list.

    try:
        len(blocklistRegexes) # Make sure blocklistRegexes is a sequence of (regex_str, str) or strs.
    except:
        raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')
    for response in blocklistRegexes:
        if isinstance(response, str):
            continue
        if len(response) != 2:
            raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')
        if not isinstance(response[0], str) or not isinstance(response[1], str):
            raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')
908303
function parseFormat(index, args, formatOptions) {
	let nextValue = args.getNextValue(index);
	if(nextValue != null) {
		formatOptions.style = getFormat(nextValue);
		return index + 2;
	}
	
	throw new Error('No format provided');
}
845585
def check_args(parser, args):
    """"""
    # Make sure only one action has been specified
    if len([a for a in [args.create, args.extract, args.verify, args.list,
                        args.list_detailed, args.hash, args.add_signature] if a
            is not None]) != 1:
        parser.error("Must specify something to do (one of -c, -x, -t, -T, -v, --hash, --add-signature)")

    if args.create and not args.files:
        parser.error("Must specify at least one file to add to marfile")

    if args.extract and args.compression not in (None, 'bz2', 'xz', 'auto'):  # pragma: nocover
        parser.error('Unsupported compression type')

    if args.create and args.compression not in (None, 'bz2', 'xz'):  # pragma: nocover
        parser.error('Unsupported compression type')

    if args.hash and len(args.files) != 1:
        parser.error("Must specify a file to output the hash for")
670042
function checkArgs(args) {
  if (args.length !== 2) {
    console.warn(`WWWW Checking claudia args: args.length !== 2, is: ${args.length}`, inspect({args}));
  }
}
1258185
def is_inexact(arg):
    '''
    
    '''
    return (is_inexact(mag(arg)) if is_quantity(arg) else
            is_npscalar(u, np.inexact) or is_npvalue(arg, np.inexact))
1161464
def _check_arg_length(fname, args, max_fname_arg_count, compat_args):
    
    if max_fname_arg_count < 0:
        raise ValueError("'max_fname_arg_count' must be non-negative")

    if len(args) > len(compat_args):
        max_arg_count = len(compat_args) + max_fname_arg_count
        actual_arg_count = len(args) + max_fname_arg_count
        argument = 'argument' if max_arg_count == 1 else 'arguments'

        raise TypeError(
            "{fname}() takes at most {max_arg} {argument} "
            "({given_arg} given)".format(
                fname=fname, max_arg=max_arg_count,
                argument=argument, given_arg=actual_arg_count))