remoting/tools/build/remoting_localize.py
def WriteIfChanged(file_name, contents, encoding):
  """
  Writes the specified contents to the specified file_name
  iff the contents are different than the current contents.
  """
  try:
    target = io.open(file_name, 'r')
    old_contents = target.read()
  except EnvironmentError:
    pass
  except UnicodeDecodeError:
    target.close()
    os.unlink(file_name)
  else:
    if contents == old_contents:
      return
    target.close()
    os.unlink(file_name)
  io.open(file_name, 'w', encoding=encoding).write(contents)

  Writes the specified contents to the specified file_name
  iff the contents are different than the current contents.
  
Writes the specified contents to the specified file_name
iff the contents are different than the current contents.
Writes the specified contents to the specified file_name iff the contents are different than the current contents .
def WriteIfChanged(file_name, contents, encoding):
  try:
    target = io.open(file_name, 'r')
    old_contents = target.read()
  except EnvironmentError:
    pass
  except UnicodeDecodeError:
    target.close()
    os.unlink(file_name)
  else:
    if contents == old_contents:
      return
    target.close()
    os.unlink(file_name)
  io.open(file_name, 'w', encoding=encoding).write(contents)
def WriteIfChanged ( file_name , contents , encoding ) : try : target = io . open ( file_name , 'r' ) old_contents = target . read ( ) except EnvironmentError : pass except UnicodeDecodeError : target . close ( ) os . unlink ( file_name ) else : if contents == old_contents : return target . close ( ) os . unlink ( file_name ) io . open ( file_name , 'w' , encoding = encoding ) . write ( contents )
Writes the specified contents to the specified file_name
iff the contents are different than the current contents.
Writes the specified contents to the specified file_name iff the contents are different than the current contents .
"""
  Writes the specified contents to the specified file_name
  iff the contents are different than the current contents.
  """
file_name
contents
encoding