def diff_fromDelta(self, text1, delta):
    """Given the original text1, and an encoded string which describes the
    operations required to transform text1 into text2, compute the full diff.

    Args:
      text1: Source string for the diff.
      delta: Delta text.

    Returns:
      Array of diff tuples.

    Raises:
      ValueError: If invalid input.
    """
    if type(delta) == unicode:
      # Deltas should be composed of a subset of ascii chars, Unicode not
      # required.  If this encode raises UnicodeEncodeError, delta is invalid.
      delta = delta.encode("ascii")
    diffs = []
    pointer = 0  # Cursor in text1
    tokens = delta.split("\t")
    for token in tokens:
      if token == "":
        # Blank tokens are ok (from a trailing \t).
        continue
      # Each token begins with a one character parameter which specifies the
      # operation of this token (delete, insert, equality).
      param = token[1:]
      if token[0] == "+":
        param = urllib.unquote(param).decode("utf-8")
        diffs.append((self.DIFF_INSERT, param))
      elif token[0] == "-" or token[0] == "=":
        try:
          n = int(param)
        except ValueError:
          raise ValueError("Invalid number in diff_fromDelta: " + param)
        if n < 0:
          raise ValueError("Negative number in diff_fromDelta: " + param)
        text = text1[pointer : pointer + n]
        pointer += n
        if token[0] == "=":
          diffs.append((self.DIFF_EQUAL, text))
        else:
          diffs.append((self.DIFF_DELETE, text))
      else:
        # Anything else is an error.
        raise ValueError("Invalid diff operation in diff_fromDelta: " +
            token[0])
    if pointer != len(text1):
      raise ValueError(
          "Delta length (%d) does not equal source text length (%d)." %
         (pointer, len(text1)))
    return diffs

  #  MATCH FUNCTIONS
dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/diff_match_patch/python2/diff_match_patch.py/diff_match_patch.diff_fromDelta/original