class_docstr: Handles upgrading a set of Python files using a given API change spec.
class_docstr_tok: ["Handles","upgrading","a","set","of","Python","files","using","a","given","API","change","spec","."]
docstr: Process the given python file for incompatible changes.
  
  Args:
    in_filename: filename to parse
    out_filename: output file to write to
    no_change_to_outfile_on_error: not modify the output file on errors
  Returns:
    A tuple representing number of files processed, log of actions, errors
docstr_tok: ["Process","the","given","python","file","for","incompatible","changes",".","Args",":","in_filename",":","filename","to","parse","out_filename",":","output","file","to","write","to","no_change_to_outfile_on_error",":","not","modify","the","output","file","on","errors","Returns",":","A","tuple","representing","number","of","files","processed",",","log","of","actions",",","errors"]
code: def process_file(
      self,
      in_filename,
      out_filename,
      no_change_to_outfile_on_error=False,
  ):
      """Process the given python file for incompatible changes.
  
      Args:
        in_filename: filename to parse
        out_filename: output file to write to
        no_change_to_outfile_on_error: not modify the output file on errors
      Returns:
        A tuple representing number of files processed, log of actions, errors
      """
  
      # Write to a temporary file, just in case we are doing an implace modify.
      # pylint: disable=g-backslash-continuation
      with open(
          in_filename, "r"
      ) as in_file, tempfile.NamedTemporaryFile(
          "w", delete=False
      ) as temp_file:
          ret = self.process_opened_file(
              in_filename, in_file, out_filename, temp_file
          )
      # pylint: enable=g-backslash-continuation
  
      if no_change_to_outfile_on_error and ret[0] == 0:
          os.remove(temp_file.name)
      else:
          shutil.move(temp_file.name, out_filename)
      return ret
  
imports: import ast
  import collections
  import os
  import re
  import shutil
  import sys
  import tempfile
  import traceback
  import pasta
label_desc: Use image node_id 2 for calling the ASTCodeUpgrader obj's underlying member method code with example usage: obj.process_file(in_filename, out_filename, no_change_to_outfile_on_error) and returns: ret