Register an argument with type knack.arguments.ignore_type (hidden/ignored)

        :param argument_dest: The destination argument to apply the ignore type to
        :type argument_dest: str
344681
def ignore(self, argument_dest, **kwargs):
        
        self._check_stale()
        if not self._applicable():
            return

        dest_option = ['--__{}'.format(argument_dest.upper())]
        self.argument(argument_dest, arg_type=ignore_type, options_list=dest_option, **kwargs)
714271
def argv_flag_dec(*argin, **kwargs):
    
    kwargs = kwargs.copy()
    kwargs['default'] = kwargs.get('default', False)
    from utool import util_decor
    @util_decor.ignores_exc_tb(outer_wrapper=False)
    def wrap_argv_flag_dec(func):
        return __argv_flag_dec(func, **kwargs)

    assert len(argin) < 2, 'specify 0 or 1 args'

    if len(argin) == 1 and util_type.is_funclike(argin[0]):
        func = argin[0]
        return wrap_argv_flag_dec(func)
    else:
        return wrap_argv_flag_dec
1287620
function Callback (retType, argTypes, abi, func) {
  debug('creating new Callback');

  if (typeof abi === 'function') {
    func = abi;
    abi = undefined;
  }

  // check args
  assert(!!retType, 'expected a return "type" object as the first argument');
  assert(Array.isArray(argTypes), 'expected Array of arg "type" objects as the second argument');
  assert.equal(typeof func, 'function', 'expected a function as the third argument');

  // normalize the "types" (they could be strings, so turn into real type
  // instances)
  retType = ref.coerceType(retType);
  argTypes = argTypes.map(ref.coerceType);

  // create the `ffi_cif *` instance
  const cif = CIF(retType, argTypes, abi);
  const argc = argTypes.length;

  const callback = _Callback(cif, retType.size, argc, errorReportCallback, (retval, params) => {
    debug('Callback function being invoked')
    try {
      const args = [];
      for (var i = 0; i < argc; i++) {
        const type = argTypes[i];
        const argPtr = params.readPointer(i * ref.sizeof.pointer, type.size);
        argPtr.type = type;
        args.push(argPtr.deref());
      }

      // Invoke the user-given function
      const result = func.apply(null, args);
      try {
        ref.set(retval, 0, result, retType);
      } catch (e) {
        e.message = 'error setting return value - ' + e.message;
        throw e;
      }
    } catch (e) {
      return e;
    }
  });

  return callback;
}
598565
def update kwargs={}
      ignore_cksum = kwargs.arg :ignore_cksum, false
      ignore_sigs = kwargs.arg :ignore_sigs, false

      cmd = 'aptly mirror update'
      cmd += ' -ignore-checksums' if ignore_cksum
      cmd += ' -ignore-signatures' if ignore_sigs
      cmd += " #{@name.quote}"

      Aptly::runcmd cmd
    end
1133530
def add_argument(self, *args, **kwargs):
        

        # if no positional args are supplied or only one is supplied and
        # it doesn't look like an option string, parse a positional
        # argument
        chars = self.prefix_chars
        if not args or len(args) == 1 and args[0][0] not in chars:
            if args and 'dest' in kwargs:
                raise ValueError('dest supplied twice for positional argument')
            kwargs = self._get_positional_kwargs(*args, **kwargs)

        # otherwise, we're adding an optional argument
        else:
            kwargs = self._get_optional_kwargs(*args, **kwargs)

        # if no default was supplied, use the parser-level default
        if 'default' not in kwargs:
            dest = kwargs['dest']
            if dest in self._defaults:
                kwargs['default'] = self._defaults[dest]
            elif self.argument_default is not None:
                kwargs['default'] = self.argument_default

        # create the action object, and add it to the parser
        action_class = self._pop_action_class(kwargs)
        if not _callable(action_class):
            raise ValueError('unknown action "%s"' % action_class)
        action = action_class(**kwargs)

        # raise an error if the action type is not callable
        type_func = self._registry_get('type', action.type, action.type)
        if not _callable(type_func):
            raise ValueError('%r is not callable' % type_func)

        return self._add_action(action)
1153073
def _deprecated_kwargs(kwargs, arg_newarg):
    
    warn_for = []
    for (arg, new_kw) in arg_newarg:
        if arg in kwargs.keys():
            val = kwargs.pop(arg)
            kwargs[new_kw] = val
            warn_for.append((arg, new_kw))
    if len(warn_for) > 0:
        if len(warn_for) == 1:
            warnings.warn("Argument '{}' is deprecated. Use {} instead".
                          format(warn_for[0][0], warn_for[0][1]),
                          DeprecationWarning, stacklevel=4)
        else:
            args = ", ".join([x[0] for x in warn_for])
            repl = ", ".join([x[1] for x in warn_for])
            warnings.warn(
                "Arguments '{}' are deprecated. Use '{}' instead respectively".
                format(args, repl),
                DeprecationWarning, stacklevel=4)
    return kwargs
1358648
def cmd(send, msg, args):
    
    parser = arguments.ArgParser(args['config'])
    group = parser.add_mutually_exclusive_group()
    group.add_argument('--clear', action='store_true')
    group.add_argument('--show', '--list', action='store_true')
    group.add_argument('--delete', '--remove', action='store_true')
    parser.add_argument('nick', nargs='?')
    try:
        cmdargs = parser.parse_args(msg)
    except arguments.ArgumentException as e:
        send(str(e))
        return
    session = args['db']
    if cmdargs.clear:
        session.query(Ignore).delete()
        send("Ignore list cleared.")
    elif cmdargs.show:
        ignored = session.query(Ignore).all()
        if ignored:
            send(", ".join([x.nick for x in ignored]))
        else:
            send("Nobody is ignored.")
    elif cmdargs.delete:
        if not cmdargs.nick:
            send("Unignore who?")
        else:
            row = session.query(Ignore).filter(Ignore.nick == cmdargs.nick).first()
            if row is None:
                send("%s is not ignored." % cmdargs.nick)
            else:
                session.delete(row)
                send("%s is no longer ignored." % cmdargs.nick)
    elif cmdargs.nick:
        send("%s ignored %s" % (args['nick'], cmdargs.nick), target=args['config']['core']['ctrlchan'])
        send(misc.ignore(session, cmdargs.nick))
    else:
        send("Ignore who?")
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
66033
def register_functions(lib, ignore_errors):
    

    def register(item):
        return register_function(lib, item, ignore_errors)

    for f in functionList:
        register(f)
122098
def apply_kwargs(func, **kwargs):
    
    new_kwargs = {}
    params = signature(func).parameters
    for param_name in params.keys():
        if param_name in kwargs:
            new_kwargs[param_name] = kwargs[param_name]
    return func(**new_kwargs)
38666
def pass_none(func):
	
	@functools.wraps(func)
	def wrapper(param, *args, **kwargs):
		if param is not None:
			return func(param, *args, **kwargs)
	return wrapper
671026
def _xray_register_type_fix(wrapped, instance, args, kwargs):
    """"""
    our_args = list(copy.copy(args))
    if len(our_args) == 2 and isinstance(our_args[1], (XRayTracedConn, XRayTracedCursor)):
        our_args[1] = our_args[1].__wrapped__

    return wrapped(*our_args, **kwargs)
692448
def pack_args(self, obj, *args, **kwargs):
        
        signature = self.__signature__
        #: No arguments expected
        if not signature:
            return (self.name, [])

        #: Build args, first is a string, subsequent are dictionaries
        method_name = [self.name]
        bridge_args = []
        for i, sig in enumerate(signature):
            if i == 0:
                method_name.append(":")
                bridge_args.append(msgpack_encoder(sig, args[0]))
                continue

            #: Sig is a dict so we must pull out the matching kwarg
            found = False
            for k in sig:
                if k in kwargs:
                    method_name.append("{}:".format(k))
                    bridge_args.append(msgpack_encoder(sig[k], kwargs[k]))
                    found = True
                    break
            if not found:
                #: If we get here something is wrong
                raise ValueError("Unexpected or missing argument at index {}. "
                                 "Expected {}".format(i, sig))

        return ("".join(method_name), bridge_args)
369747
def get_cli_parser(func, skip_first=0, parser=None):
    
    help_msg, func_args = _get_func_args(func)
    if not parser:
        parser = ArgumentParser(description=help_msg)

    for i, arg in enumerate(func_args):
        arg_name, arg_type, arg_default, arg_required, arg_help = arg
        if i < skip_first:
            continue

        if arg_default is not _empty:
            parser.add_argument(
                arg_name, type=arg_type, default=arg_default,
                required=arg_required, help=arg_help
            )
        else:
            parser.add_argument(
                arg_name, type=arg_type, required=arg_required, help=arg_help
            )
    return parser
155519
def getopt_with_ignore(args, shortopts, longopts=[]):
        
        opts = []
        prog_args = []
        if isinstance(longopts, str):
            longopts = [longopts]
        else:
            longopts = list(longopts)
        while args:
            if args[0] == '--':
                prog_args += args[1:]
                break
            if args[0].startswith('--'):
                try:
                    opts, args = getopt.do_longs(
                        opts,
                        args[0][2:],
                        longopts,
                        args[1:]
                    )
                except getopt.GetoptError:
                    args = args[1:]
            elif args[0][0] == '-':
                try:
                    opts, args = getopt.do_shorts(
                        opts,
                        args[0][1:],
                        shortopts,
                        args[1:]
                    )
                except getopt.GetoptError:
                    args = args[1:]
            else:
                prog_args.append(args[0])
                args = args[1:]
        return opts, prog_args
516929
def _GetArgsDescription(self, args_type):
    """"""
    args = {}
    if args_type:
      for type_descriptor in args_type.type_infos:
        if not type_descriptor.hidden:
          args[type_descriptor.name] = {
              "description": type_descriptor.description,
              "default": type_descriptor.default,
              "type": "",
          }
          if type_descriptor.type:
            args[type_descriptor.name]["type"] = type_descriptor.type.__name__
    return args
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