deepvariant/testing/flagsaver.py
def RestoreFlagValues(saved_flag_values):
  """Restores flag values based on the dictionary of flag values.

  Args:
    saved_flag_values: {'key': value_dict, ...}
  """
  if hasattr(flags, '_FlagValues'):  # pylint:disable=protected-access
    # In OSS code we use tensorflow/python/platform/flags.py:_FlagValues
    # which is not iterable.
    new_flag_names = FLAGS.__dict__['__flags'].keys()
  else:
    # FLAGS is iterable and provides __getitem__.
    new_flag_names = list(FLAGS)

  for name in new_flag_names:
    value = saved_flag_values.get(name)
    if value is None:
      # If value was not saved delete it
      if hasattr(flags, '_FlagValues'):  # pylint:disable=protected-access
        # In OSS code we use tensorflow/python/platform/flags.py.
        del FLAGS.__dict__['__flags'][name]
      else:
        delattr(FLAGS, name)

    else:
      if hasattr(flags, '_FlagValues'):  # pylint:disable=protected-access
        # In OSS code we use tensorflow/python/platform/flags.py:_FlagValues
        # which is not iterable.
        FLAGS.__dict__['__flags'][name] = value
      else:
        # We bypass the overridden __setitem__ and __setattr__ methods of FLAGS.
        FLAGS[name].__dict__ = value
Restores flag values based on the dictionary of flag values.

  Args:
    saved_flag_values: {'key': value_dict, ...}
  
Restores flag values based on the dictionary of flag values.
Restores flag values based on the dictionary of flag values .
def RestoreFlagValues(saved_flag_values):
  if hasattr(flags, '_FlagValues'):  
    new_flag_names = FLAGS.__dict__['__flags'].keys()
  else:
    new_flag_names = list(FLAGS)
  for name in new_flag_names:
    value = saved_flag_values.get(name)
    if value is None:
      if hasattr(flags, '_FlagValues'):  
        del FLAGS.__dict__['__flags'][name]
      else:
        delattr(FLAGS, name)
    else:
      if hasattr(flags, '_FlagValues'):  
        FLAGS.__dict__['__flags'][name] = value
      else:
        FLAGS[name].__dict__ = value
def RestoreFlagValues ( saved_flag_values ) : if hasattr ( flags , '_FlagValues' ) : new_flag_names = FLAGS . __dict__ [ '__flags' ] . keys ( ) else : new_flag_names = list ( FLAGS ) for name in new_flag_names : value = saved_flag_values . get ( name ) if value is None : if hasattr ( flags , '_FlagValues' ) : del FLAGS . __dict__ [ '__flags' ] [ name ] else : delattr ( FLAGS , name ) else : if hasattr ( flags , '_FlagValues' ) : FLAGS . __dict__ [ '__flags' ] [ name ] = value else : FLAGS [ name ] . __dict__ = value
Restores flag values based on the dictionary of flag values.
Restores flag values based on the dictionary of flag values .
"""Restores flag values based on the dictionary of flag values.

  Args:
    saved_flag_values: {'key': value_dict, ...}
  """ # pylint:disable=protected-access # In OSS code we use tensorflow/python/platform/flags.py:_FlagValues # which is not iterable. # FLAGS is iterable and provides __getitem__. # If value was not saved delete it # pylint:disable=protected-access # In OSS code we use tensorflow/python/platform/flags.py. # pylint:disable=protected-access # In OSS code we use tensorflow/python/platform/flags.py:_FlagValues # which is not iterable. # We bypass the overridden __setitem__ and __setattr__ methods of FLAGS.
saved_flag_values
None