(path)
Atomically saves data to a target path.

  Any existing data at the target path will be overwritten.

  Args:
    path: target path at which to save file

  Yields:
    file-like object
Atomically saves data to a target path.
Atomically saves data to a target path .
def atomic_file(path):
  """Atomically saves data to a target path.

  Any existing data at the target path will be overwritten.

  Args:
    path: target path at which to save file

  Yields:
    file-like object
  """
  with tempfile.NamedTemporaryFile() as tmp:
    yield tmp
    tmp.flush()
    tf.gfile.Copy(tmp.name, "%s.tmp" % path, overwrite=True)
  tf.gfile.Rename("%s.tmp" % path, path, overwrite=True)
def atomic_file ( path ) : with tempfile . NamedTemporaryFile ( ) as tmp : yield tmp tmp . flush ( ) tf . gfile . Copy ( tmp . name , "%s.tmp" % path , overwrite = True ) tf . gfile . Rename ( "%s.tmp" % path , path , overwrite = True )