deepvariant/testing/flagsaver.py
def _FlagSaver(func, overrides):
  """Creates a wrapper function that saves/restores flag values.

  Args:
    func: function object - This will be called between saving flags and
      restoring flags.
    overrides: {str: object} - Flag names mapped to their values.  These flags
      will be set after saving the original flag state.

  Returns:
    return value from func()
  """

  @functools.wraps(func)
  def _FlagSaverWrapper(*args, **kwargs):
    """Wrapper function that saves and restores flags."""
    with FlagContext(**overrides):
      return func(*args, **kwargs)

  return _FlagSaverWrapper
Creates a wrapper function that saves/restores flag values.

  Args:
    func: function object - This will be called between saving flags and
      restoring flags.
    overrides: {str: object} - Flag names mapped to their values.  These flags
      will be set after saving the original flag state.

  Returns:
    return value from func()
  
Creates a wrapper function that saves/restores flag values.
Creates a wrapper function that saves / restores flag values .
def _FlagSaver(func, overrides):
  @functools.wraps(func)
  def _FlagSaverWrapper(*args, **kwargs):
    with FlagContext(**overrides):
      return func(*args, **kwargs)
  return _FlagSaverWrapper
def _FlagSaver ( func , overrides ) : @ functools . wraps ( func ) def _FlagSaverWrapper ( * args , ** kwargs ) : """Wrapper function that saves and restores flags.""" with FlagContext ( ** overrides ) : return func ( * args , ** kwargs ) return _FlagSaverWrapper
Creates a wrapper function that saves/restores flag values.
Creates a wrapper function that saves / restores flag values .
"""Creates a wrapper function that saves/restores flag values.

  Args:
    func: function object - This will be called between saving flags and
      restoring flags.
    overrides: {str: object} - Flag names mapped to their values.  These flags
      will be set after saving the original flag state.

  Returns:
    return value from func()
  """ """Wrapper function that saves and restores flags."""
return value from func()
return value from func ()
func
function object - This will be called between saving flags and
restoring flags.
function object - This will be called between saving flags and restoring flags .
overrides
{str: object} - Flag names mapped to their values.  These flags
will be set after saving the original flag state.
{ str : object } - Flag names mapped to their values . These flags will be set after saving the original flag state .