parameters: (iwyu_records, flags)
return_statement: return files_fixed if not flags.dry_run else 0
docstring: Given a list of iwyu_records, fix each file listed in the record.
  
    For each iwyu record in the input, which lists the #includes and
    forward-declares to add, remove, and re-sort, loads the file, makes
    the fixes, and writes the fixed file to disk.  The flags affect the
    details of the fixing.
  
    Arguments:
      iwyu_records: a collection of IWYUOutputRecord objects holding
        the parsed output of the include-what-you-use script (run at
        verbose level 1 or higher) pertaining to a single source file.
        iwyu_record.filename indicates what file to edit.
      flags: commandline flags, as parsed by optparse..
  
    Returns:
      The number of files fixed (as opposed to ones that needed no fixing).
docstring_summary: Given a list of iwyu_records, fix each file listed in the record.
docstring_tokens: Given a list of iwyu_records fix each file listed in the record .
function: def FixManyFiles(iwyu_records, flags):
    """Given a list of iwyu_records, fix each file listed in the record.
  
    For each iwyu record in the input, which lists the #includes and
    forward-declares to add, remove, and re-sort, loads the file, makes
    the fixes, and writes the fixed file to disk.  The flags affect the
    details of the fixing.
  
    Arguments:
      iwyu_records: a collection of IWYUOutputRecord objects holding
        the parsed output of the include-what-you-use script (run at
        verbose level 1 or higher) pertaining to a single source file.
        iwyu_record.filename indicates what file to edit.
      flags: commandline flags, as parsed by optparse..
  
    Returns:
      The number of files fixed (as opposed to ones that needed no fixing).
    """
    files_fixed = 0
    for iwyu_record in iwyu_records:
      try:
        fileinfo = FileInfo.parse(iwyu_record.filename)
  
        file_contents = _ReadFile(iwyu_record.filename, fileinfo)
        if not file_contents:
          continue
  
        print(">>> Fixing #includes in '%s'" % iwyu_record.filename, file=sys.stderr)
        old_lines, fixed_lines = FixOneFile(iwyu_record, file_contents, flags, fileinfo)
        if old_lines == fixed_lines:
          print("No changes in file %s" % iwyu_record.filename, file=sys.stderr)
          continue
  
        if flags.dry_run:
          PrintFileDiff(old_lines, fixed_lines, os.path.relpath(iwyu_record.filename, start=flags.basedir if flags.basedir else os.curdir))
        else:
          _WriteFile(iwyu_record.filename, fileinfo, fixed_lines)
  
        files_fixed += 1
      except FixIncludesError as why:
        print('ERROR: %s - skipping file %s' % (why, iwyu_record.filename), file=sys.stderr)
  
    print('IWYU edited %d files on your behalf.\n' % files_fixed, file=sys.stderr)
  
    # In case of a dry_run we return 0 to indicate success, otherwise we
    # return the number of modified files as our return code.
    return files_fixed if not flags.dry_run else 0
function_tokens: def FixManyFiles ( iwyu_records , flags ) : files_fixed = 0 for iwyu_record in iwyu_records : try : fileinfo = FileInfo . parse ( iwyu_record . filename ) file_contents = _ReadFile ( iwyu_record . filename , fileinfo ) if not file_contents : continue print ( ">>> Fixing #includes in '%s'" % iwyu_record . filename , file = sys . stderr ) old_lines , fixed_lines = FixOneFile ( iwyu_record , file_contents , flags , fileinfo ) if old_lines == fixed_lines : print ( "No changes in file %s" % iwyu_record . filename , file = sys . stderr ) continue if flags . dry_run : PrintFileDiff ( old_lines , fixed_lines , os . path . relpath ( iwyu_record . filename , start = flags . basedir if flags . basedir else os . curdir ) ) else : _WriteFile ( iwyu_record . filename , fileinfo , fixed_lines ) files_fixed += 1 except FixIncludesError as why : print ( 'ERROR: %s - skipping file %s' % ( why , iwyu_record . filename ) , file = sys . stderr ) print ( 'IWYU edited %d files on your behalf.\n' % files_fixed , file = sys . stderr ) # In case of a dry_run we return 0 to indicate success, otherwise we # return the number of modified files as our return code. return files_fixed if not flags . dry_run else 0