def FlagOverrider(**flag_kwargs):

  def Decorator(f):
    """Allow a function to safely change flags, restoring them on return."""
    def Decorated(*args, **kwargs):
      global FLAGS

      old_flags = copy.copy(FLAGS)

      for k, v in flag_kwargs.items():
        setattr(FLAGS, k, v)

      try:
        return f(*args, **kwargs)
      finally:
        FLAGS = old_flags

    return Decorated

  return Decorator
Constructor
dataset/ETHPy150Open google/grr/grr/lib/flags.py/FlagOverrider--crossover with--dataset/ETHPy150Open sdispater/cleo/cleo/application.py/Application.__init__