def atomic_copy(src, dst):
 with temporary_file(root_dir=os.path.dirname(dst)) as tmp_dst:
  shutil.copyfile(src, tmp_dst.name)
  os.chmod(tmp_dst.name, os.stat(src).st_mode)
  os.rename(tmp_dst.name, dst)

def atomic_copy ( src , dst ) : with temporary_file ( root_dir = os . path . dirname ( dst ) ) as tmp_dst : shutil . copyfile ( src , tmp_dst . name ) os . chmod ( tmp_dst . name , os . stat ( src ) . st_mode ) os . rename ( tmp_dst . name , dst )
copy the file src to dst .