parameters: (generated_file, static_file)
return_statement: return True
docstring: Return True if the two files contain the same textual changes.
  
    There may be extra generated lines and generated lines are still considered
    to "match" static ones even if they have extra formatting/text at their
    beginnings and ends.
    Line numbers may differ but order may not.
docstring_summary: Return True if the two files contain the same textual changes.
docstring_tokens: Return True if the two files contain the same textual changes .
function: def _ChangesMatch(generated_file, static_file):
    """Return True if the two files contain the same textual changes.
  
    There may be extra generated lines and generated lines are still considered
    to "match" static ones even if they have extra formatting/text at their
    beginnings and ends.
    Line numbers may differ but order may not.
    """
    if not generated_file and not static_file:
      return True  # Neither file affected.
  
    if not generated_file or not static_file:
      return False  # One file missing.
  
    generated_changes = generated_file.ChangedContents()
    static_changes = static_file.ChangedContents()
    # ChangedContents() is a list of (line number, text) for all new lines.
    # Ignore the line number, but check that the text for each new line matches.
  
    next_generated = 0
    start_pos = 0
    for next_static in range(len(static_changes)):
      _, static_text = static_changes[next_static]
  
      # Search generated changes for this static text.
      found = False
      while not found and next_generated < len(generated_changes):
        _, generated_text = generated_changes[next_generated]
        # Text need not be identical but the entire static line should be
        # in the generated one (e.g. generated text might have extra formatting).
        found_at = generated_text[start_pos:].find(static_text)
        if found_at != -1:
          # Next search starts on the same line, after the substring matched.
          start_pos = found_at + len(static_text)
          found  = True
        else:
          next_generated += 1
          start_pos = 0
  
      if not found:
        return False
  
    return True
function_tokens: def _ChangesMatch ( generated_file , static_file ) : if not generated_file and not static_file : return True # Neither file affected. if not generated_file or not static_file : return False # One file missing. generated_changes = generated_file . ChangedContents ( ) static_changes = static_file . ChangedContents ( ) # ChangedContents() is a list of (line number, text) for all new lines. # Ignore the line number, but check that the text for each new line matches. next_generated = 0 start_pos = 0 for next_static in range ( len ( static_changes ) ) : _ , static_text = static_changes [ next_static ] # Search generated changes for this static text. found = False while not found and next_generated < len ( generated_changes ) : _ , generated_text = generated_changes [ next_generated ] # Text need not be identical but the entire static line should be # in the generated one (e.g. generated text might have extra formatting). found_at = generated_text [ start_pos : ] . find ( static_text ) if found_at != - 1 : # Next search starts on the same line, after the substring matched. start_pos = found_at + len ( static_text ) found = True else : next_generated += 1 start_pos = 0 if not found : return False return True