def diff_compute(self, text1, text2, checklines, deadline):
    """Find the differences between two texts.  Assumes that the texts do not
      have any common prefix or suffix.

    Args:
      text1: Old string to be diffed.
      text2: New string to be diffed.
      checklines: Speedup flag.  If false, then don't run a line-level diff
        first to identify the changed areas.
        If true, then run a faster, slightly less optimal diff.
      deadline: Time when the diff should be complete by.

    Returns:
      Array of changes.
    """
    if not text1:
      # Just add some text (speedup).
      return [(self.DIFF_INSERT, text2)]

    if not text2:
      # Just delete some text (speedup).
      return [(self.DIFF_DELETE, text1)]

    if len(text1) > len(text2):
      (longtext, shorttext) = (text1, text2)
    else:
      (shorttext, longtext) = (text1, text2)
    i = longtext.find(shorttext)
    if i != -1:
      # Shorter text is inside the longer text (speedup).
      diffs = [(self.DIFF_INSERT, longtext[:i]), (self.DIFF_EQUAL, shorttext),
               (self.DIFF_INSERT, longtext[i + len(shorttext):])]
      # Swap insertions for deletions if diff is reversed.
      if len(text1) > len(text2):
        diffs[0] = (self.DIFF_DELETE, diffs[0][1])
        diffs[2] = (self.DIFF_DELETE, diffs[2][1])
      return diffs

    if len(shorttext) == 1:
      # Single character string.
      # After the previous speedup, the character can't be an equality.
      return [(self.DIFF_DELETE, text1), (self.DIFF_INSERT, text2)]

    # Check to see if the problem can be split in two.
    hm = self.diff_halfMatch(text1, text2)
    if hm:
      # A half-match was found, sort out the return data.
      (text1_a, text1_b, text2_a, text2_b, mid_common) = hm
      # Send both pairs off for separate processing.
      diffs_a = self.diff_main(text1_a, text2_a, checklines, deadline)
      diffs_b = self.diff_main(text1_b, text2_b, checklines, deadline)
      # Merge the results.
      return diffs_a + [(self.DIFF_EQUAL, mid_common)] + diffs_b

    if checklines and len(text1) > 100 and len(text2) > 100:
      return self.diff_lineMode(text1, text2, deadline)

    return self.diff_bisect(text1, text2, deadline)
dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/diff_match_patch/python2/diff_match_patch.py/diff_match_patch.diff_compute/original