A decorator for flags classes to forbid flag aliases.
543760
def unique(flags_class):
    
    if not is_flags_class_final(flags_class):
        raise TypeError('unique check can be applied only to flags classes that have members')
    if not flags_class.__member_aliases__:
        return flags_class
    aliases = ', '.join('%s -> %s' % (alias, name) for alias, name in flags_class.__member_aliases__.items())
    raise ValueError('duplicate values found in %r: %s' % (flags_class, aliases))
93761
def _add_or_remove_flag(self, flag, add):
        
        meth = self.add_flag if add else self.remove_flag
        meth(flag)
607258
def normalize_flags(self, flags):
        
        flags['type'] = flags.get('type', None)
        paction = flags.get('action', 'store')
        if paction == 'store_false':
            flags['default'] = True 
            flags['type'] = bool

        elif paction == 'store_true':
            flags['default'] = False
            flags['type'] = bool

        prequired = False if 'default' in flags else flags.get('required', True)

        flags["action"] = paction
        flags["required"] = prequired
        self.flags = flags
598498
def setFlag(self, flag, state=True):
        
        if state:
            self.__flags |= flag
        else:
            self.__flags &= ~flag
1292267
int writeFlagAttrs(long flags) {
        int acount = 0;
        if ((flags & DEPRECATED) != 0) {
            int alenIdx = writeAttr(names.Deprecated);
            endAttr(alenIdx);
            acount++;
        }
        return acount;
    }
1302927
def deprecated(message=None):
    

    def decorated_method_to_deprecate(func):
        if inspect.isclass(func):
            # Handle a deprecated class differently from a deprecated method
            msg = "Class {}() is DEPRECATED! *** ".format(func.__name__)
            if message:
                msg += "<> %s <>" % message
            warnings.simplefilter('always', DeprecationWarning)  # See Warnings
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
            warnings.simplefilter('default', DeprecationWarning)  # Set Default
            return func

        @wraps(func)
        def new_func(*args, **kwargs):
            msg = "Method {}() is DEPRECATED! *** ".format(func.__name__)
            if message:
                msg += "<> %s <>" % message
            warnings.simplefilter('always', DeprecationWarning)  # See Warnings
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
            warnings.simplefilter('default', DeprecationWarning)  # Set Default
            return func(*args, **kwargs)
        return new_func
    return decorated_method_to_deprecate
1009949
def re_flags_str(flags, custom_flags):
    
    res = ''
    for flag in RE_FLAGS:
        if flags & getattr(re, flag):
            res += flag
    for flag in RE_CUSTOM_FLAGS:
        if custom_flags & getattr(ReFlags, flag):
            res += flag
    return res
729457
def DEFINE_float(flag_name, default_value, docstring, required=False):  # pylint: disable=invalid-name
    
    _define_helper(flag_name, default_value, docstring, float, required)
87453
def flag_arg(key, desc, opts = {}, &block)
            self << ArgParser::FlagArgument.new(key, desc, opts, &block)
        end
1365456
def override_if_not_in_args(flag, argument, args):
  """"""
  if flag not in args:
    args.extend([flag, argument])
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
868889
def restrict_flags(declarer, *flags)
      copy = restrict(declarer)
      copy.qualify(*flags)
      copy
    end
705074
def _consume_flags(self):
    """"""
    flags = []
    while self._at_flag():
      flag = self._unconsumed_args.pop()
      if not self._check_for_help_request(flag):
        flags.append(flag)
    return flags
632436
def relaxParserSetFlag(self, flags):
        
        ret = libxml2mod.xmlRelaxParserSetFlag(self._o, flags)
        return ret
1004936
def _strip_undefok_args(undefok, args):
  """"""
  if undefok:
    undefok_names = set(name.strip() for name in undefok.split(','))
    undefok_names |= set('no' + name for name in undefok_names)
    # Remove undefok flags.
    args = [arg for arg in args if not _is_undefok(arg, undefok_names)]
  return args
1254851
def filter_flags(parsed_flags, valid_flags):
    """"""
    def valid_argv(argv):
        """Figures out if a flag parsed from the flagfile matches a flag in
        the command about to be run."""
        flagname_match = FLAG_RE.match(argv)
        if not flagname_match:
            return True
        flagname = flagname_match.group()
        return flagname in valid_flags
    return list(filter(valid_argv, parsed_flags))
743179
def define_help_flags():
  """"""
  # Use a global to ensure idempotence.
  global _define_help_flags_called

  if not _define_help_flags_called:
    flags.DEFINE_flag(HelpFlag())
    flags.DEFINE_flag(HelpshortFlag())  # alias for --help
    flags.DEFINE_flag(HelpfullFlag())
    flags.DEFINE_flag(HelpXMLFlag())
    _define_help_flags_called = True