Set all named arguments shortcuts and flags.
166289
def __fix_args(kwargs):
    
    kwargs.setdefault('fixed_strings', kwargs.get('F'))
    kwargs.setdefault('basic_regexp', kwargs.get('G'))
    kwargs.setdefault('extended_regexp', kwargs.get('E'))
    kwargs.setdefault('ignore_case', kwargs.get('i'))
    kwargs.setdefault('invert', kwargs.get('v'))
    kwargs.setdefault('words', kwargs.get('w'))
    kwargs.setdefault('line', kwargs.get('x'))
    kwargs.setdefault('count', kwargs.get('c'))
    kwargs.setdefault('max_count', kwargs.get('m'))
    kwargs.setdefault('after_context', kwargs.get('A'))
    kwargs.setdefault('before_context', kwargs.get('B'))
    kwargs.setdefault('quiet', kwargs.get('q'))
    kwargs.setdefault('byte_offset', kwargs.get('b'))
    kwargs.setdefault('only_matching', kwargs.get('o'))
    kwargs.setdefault('line_number', kwargs.get('n'))
    kwargs.setdefault('regex_flags', kwargs.get('r'))
    kwargs.setdefault('keep_eol', kwargs.get('k'))
    kwargs.setdefault('trim', kwargs.get('t'))
913501
public void setArguments(List<AstNode> arguments) {
        if (arguments == null) {
            this.arguments = null;
        } else {
            if (this.arguments != null)
                this.arguments.clear();
            for (AstNode arg : arguments) {
                addArgument(arg);
            }
        }
    }
302482
def flags_as_args():
  """"""
  if hasattr(FLAGS, "flag_values_dict"):
    args_dict = FLAGS.flag_values_dict()
  else:
    args_dict = dict(FLAGS.__dict__["__flags"])
  del args_dict["cloud_mlengine"]
  # Configured later
  del args_dict["t2t_usr_dir"]
  args_dict.pop("h", None)
  args_dict.pop("helpfull", None)
  args_dict.pop("helpshort", None)
  args_dict.pop("help", None)
  args = []
  for name, val in args_dict.items():
    if val is None:
      continue
    if name.startswith("autotune"):
      continue
    args.extend(["--%s=%s" % (name, str(val))])
  return args
1358848
def reset(self, **kwargs):
        
        for key in kwargs:
            setattr(self, key, kwargs[key])
        self.command = self.COMMAND_RESET
1170406
def set_entry_points(self, names):
        
        names = util.return_set(names)
        self.entry_point_names = names
529929
def iter_shortcuts():
    """"""
    for context_name, keystr in CONF.items('shortcuts'):
        context, name = context_name.split("/", 1)
        yield context, name, keystr
1011447
def set(self, name, value):
        
        flag = self.flags[name]
        self._value = (self.value | flag) if value else (self.value & ~flag)
868721
private void bindShortcuts(Map<Object, Object> shortcuts) {
        for (Object commandName : shortcuts.keySet()) {
            bindShortcuts(commandName.toString(), shortcuts.get(commandName).toString());
        }
    }
831270
def _initialize(self, *args, **kwargs):
        """"""
        self.items = None
        self.keys = None
        self.values = None

        if args:
            if len(args) != 2:
                raise TypeError("expected exactly two positional arguments, "
                                "got %s" % len(args))
            if kwargs:
                raise TypeError(
                    "expected positional or keyword arguments, not both")

            # got positional arguments only
            self.keys, self.values = map(self._validate_argument, args)
        elif kwargs:
            has_kv = 'keys' in kwargs and 'values' in kwargs
            has_of = 'of' in kwargs
            if not (has_kv or has_of):
                raise TypeError("expected keys/values or items matchers, "
                                "but got: %s" % list(kwargs.keys()))
            if has_kv and has_of:
                raise TypeError(
                    "expected keys & values, or items matchers, not both")

            if has_kv:
                # got keys= and values= matchers
                self.keys = self._validate_argument(kwargs['keys'])
                self.values = self._validate_argument(kwargs['values'])
            else:
                # got of= matcher, which can be a tuple of matchers,
                # or a single matcher for dictionary items
                of = kwargs['of']
                if isinstance(of, tuple):
                    try:
                        # got of= as tuple of matchers
                        self.keys, self.values = \
                            map(self._validate_argument, of)
                    except ValueError:
                        raise TypeError(
                            "of= tuple has to be a pair of matchers/types" % (
                                self.__class__.__name__,))
                else:
                    # got of= as a single matcher
                    self.items = self._validate_argument(of)
52135
def set_arg(self, value):
        
        named_arg = '{0}A{1}'.format(self.arg_prefix, self.arg_index)
        self.args[named_arg] = value
        self.arg_index += 1
        return named_arg
91682
def _define_absl_flags(self, absl_flags):
    """"""
    key_flags = set(absl_flags.get_key_flags_for_module(sys.argv[0]))
    for name in absl_flags:
      if name in _BUILT_IN_FLAGS:
        # Do not inherit built-in flags.
        continue
      flag_instance = absl_flags[name]
      # Each flags with short_name appears in FLAGS twice, so only define
      # when the dictionary key is equal to the regular name.
      if name == flag_instance.name:
        # Suppress the flag in the help short message if it's not a main
        # module's key flag.
        suppress = flag_instance not in key_flags
        self._define_absl_flag(flag_instance, suppress)
1371043
def _set_int(self, commands, name):
        
        if name in commands:
            try:
                value = int(commands[name])
                setattr(self, name, value)
            except ValueError:
                pass
916643
def _set_flags(self, **flags):
        '''
        
        '''
        self._flags = enum.IntEnum('_flags', flags)
        self.__dict__.update(self._flags.__members__)
        self._patch_flag_doc()
480983
def _define_absl_flag(self, flag_instance, suppress):
    """"""
    flag_name = flag_instance.name
    short_name = flag_instance.short_name
    argument_names = ['--' + flag_name]
    if short_name:
      argument_names.insert(0, '-' + short_name)
    if suppress:
      helptext = argparse.SUPPRESS
    else:
      # argparse help string uses %-formatting. Escape the literal %'s.
      helptext = flag_instance.help.replace('%', '%%')
    if flag_instance.boolean:
      # Only add the `no` form to the long name.
      argument_names.append('--no' + flag_name)
      self.add_argument(
          *argument_names, action=_BooleanFlagAction, help=helptext,
          metavar=flag_instance.name.upper(),
          flag_instance=flag_instance)
    else:
      self.add_argument(
          *argument_names, action=_FlagAction, help=helptext,
          metavar=flag_instance.name.upper(),
          flag_instance=flag_instance)
315171
def set_global_defaults(**kwargs):
    """"""

    valid_options = [
        'active', 'selected', 'disabled', 'on', 'off',
        'on_active', 'on_selected', 'on_disabled',
        'off_active', 'off_selected', 'off_disabled',
        'color', 'color_on', 'color_off',
        'color_active', 'color_selected', 'color_disabled',
        'color_on_selected', 'color_on_active', 'color_on_disabled',
        'color_off_selected', 'color_off_active', 'color_off_disabled',
        'animation', 'offset', 'scale_factor',
        ]

    for kw in kwargs:
        if kw in valid_options:
            _default_options[kw] = kwargs[kw]
        else:
            error = "Invalid option '{0}'".format(kw)
            raise KeyError(error)
986554
def _init_helper(self, vars_):
        """"""
        for k in vars_:
            if k == 'kwargs':
                for kwarg in vars_[k]:
                    setattr(self, kwarg, vars_[k][kwarg])
            elif k != 'self':
                setattr(self, k, vars_[k])
11039
def set_params(self, prog=None, params=""):
        
        dest_prog = "to {0}".format(prog) if prog else ""
        self.add_option("--params", dest="extra", default=params,
                help="Extra parameters to pass {0}".format(dest_prog) + \
                     " (these WILL NOT be validated)")