parameters: (changelog, output_file, input_file, merged_files)
docstring: Write the changelog to the output file.
  
      The input file and the list of merged files are used only for sanity
      checks on the output.
docstring_summary: Write the changelog to the output file.
docstring_tokens: Write the changelog to the output file .
function: def finish_output(changelog, output_file, input_file, merged_files):
      """Write the changelog to the output file.
  
      The input file and the list of merged files are used only for sanity
      checks on the output.
      """
      if os.path.exists(output_file) and not os.path.isfile(output_file):
          # The output is a non-regular file (e.g. pipe). Write to it directly.
          output_temp = output_file
      else:
          # The output is a regular file. Write to a temporary file,
          # then move it into place atomically.
          output_temp = output_file + '.tmp'
      changelog.write(output_temp)
      check_output(output_temp, input_file, merged_files)
      if output_temp != output_file:
          os.rename(output_temp, output_file)
function_tokens: def finish_output ( changelog , output_file , input_file , merged_files ) : if os . path . exists ( output_file ) and not os . path . isfile ( output_file ) : # The output is a non-regular file (e.g. pipe). Write to it directly. output_temp = output_file else : # The output is a regular file. Write to a temporary file, # then move it into place atomically. output_temp = output_file + '.tmp' changelog . write ( output_temp ) check_output ( output_temp , input_file , merged_files ) if output_temp != output_file : os . rename ( output_temp , output_file )