Check the one arg option.
Error and exit if one argument is not provided.
975325
private void checkOneArg(List<String> args, int index) throws OptionException {
        if ((index + 1) >= args.size() || args.get(index + 1).startsWith("-d")) {
            String text = messager.getText("main.requires_argument", args.get(index));
            throw new OptionException(CMDERR, this::usage, text);
        }
    }
231152
def error(self, message, print_help=False):
        """"""
        if 'too few arguments' in message.lower():
            target = sys.argv.pop(0)
            sys.argv.insert(
                0, os.path.basename(target) or os.path.relpath(target))
            message = ("%s. Try getting help with `%s --help`"
                       % (message, " ".join(sys.argv)))
        if print_help:
            self.print_help()
        else:
            self.print_usage()
        sys.stderr.write('\nerror: %s\n' % message)
        sys.exit(2)
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
681701
def check_output_error_and_retcode(*popenargs, **kwargs):
    
    if 'stdout' in kwargs:
        raise ValueError('stdout argument not allowed, it will be overridden.')
    process = subprocess.Popen(stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               *popenargs, **kwargs)
    output, error = process.communicate()
    retcode = process.poll()
    return output, error, retcode
1343097
def check_arguments(params, *args)
      contains = true
      args.each do |arg|
        contains = false unless params.key? arg.to_sym
      end
      contains
    end
701690
def _check_arguments(self):
        """"""
        if self.argument_checked:
            return

        assert(self.symbol is not None)
        self.argument_checked = True

        # check if symbol contain duplicated names.
        _check_arguments(self.symbol)
        # rematch parameters to delete useless ones
        if self.allow_extra_params:
            if self.arg_params:
                arg_names = set(self.symbol.list_arguments())
                self.arg_params = {k : v for k, v in self.arg_params.items()
                                   if k in arg_names}
            if self.aux_params:
                aux_names = set(self.symbol.list_auxiliary_states())
                self.aux_params = {k : v for k, v in self.aux_params.items()
                                   if k in aux_names}
845186
public static String checkNotEmpty(String arg, @Nullable Object errorMessage) {
    boolean empty = Strings.isNullOrEmpty(arg) || CharMatcher.whitespace().matchesAllOf(arg);
    checkArgument(!empty, errorMessage);
    return arg;
  }
362390
def verifyArguments(self, arg):
        
        for l in arg:
            if not type(l) == list and \
               not type(l) == type(Numeric.array([0.0])) and \
               not type(l) == tuple and \
               not type(l) == dict:
                return 0
            if type(l) == dict:
                for i in l:
                    if not type(i) == str and i not in list(self.layers.keys()):
                        return 0
            else:
                for i in l:
                    if not type(i) == float and not type(i) == int:
                        return 0
        return 1
549869
function onExit() {
  if (!onExit.done) {
    if (options.strict !== true) showLoadingErrors()
    if (options.debug === true) showDebugInfo()
  }
  onExit.done = true
}
362551
def check_help():
    
    # know arguments
    know = set(('-h', '--help', '-v', '--version'))
    # arguments
    args = set(sys.argv[1:])
    # returns True if there is at least one known argument in arguments
    return len(know.intersection(args)) > 0
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)
1255425
def p_Arg(p):
    '''
    
    '''
    if len(p) <= 2:
        p[0] = Arg(p[1], None)
    else:
        p[0] = Arg(p[1], p[2])
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)
1245374
function execute(args) {
    try {
        const currentOptions = options.parse(args)
        return executeOptions(currentOptions)
    } catch (error) {
        console.error(error.message)
        return 1
    }
}
366383
def has_args():
        '''  '''
        no_args_syntax = '@overload'
        args_syntax = no_args_syntax + '('
        args, no_args = [(-1,-1)], [(-1,-1)]
        for i, line in enumerate(Overload.traceback_lines()):
            if args_syntax in line:
                args.append((i, line.find(args_syntax)))
            if no_args_syntax in line:
                no_args.append((i, line.find(no_args_syntax)))
        args, no_args = max(args), max(no_args)
        if sum(args)+sum(no_args) == -4:
            # couldnt find invocation
            return False
        return args >= no_args
1321661
def _arg2opt(arg):
    '''
    
    '''
    res = [o for o, a in option_toggles.items() if a == arg]
    res += [o for o, a in option_flags.items() if a == arg]
    return res[0] if res else None
488877
def validate_args_count(expected, got)
      if (expected.is_a?(Numeric) and expected != got) or
         (expected.is_a?(Range) and !(expected === got))
        raise ArgumentError, "wrong number of arguments for '#{name}' (#{got} for #{expected})"
      end
    end