def diff_toDelta(self, diffs):
    """Crush the diff into an encoded string which describes the operations
    required to transform text1 into text2.
    E.g. =3\t-2\t+ing  -> Keep 3 chars, delete 2 chars, insert 'ing'.
    Operations are tab-separated.  Inserted text is escaped using %xx notation.

    Args:
      diffs: Array of diff tuples.

    Returns:
      Delta text.
    """
    text = []
    for (op, data) in diffs:
      if op == self.DIFF_INSERT:
        # High ascii will raise UnicodeDecodeError.  Use Unicode instead.
        data = data.encode("utf-8")
        text.append("+" + urllib.quote(data, "!~*'();/?:@&=+$,# "))
      elif op == self.DIFF_DELETE:
        text.append("-%d" % len(data))
      elif op == self.DIFF_EQUAL:
        text.append("=%d" % len(data))
    return "\t".join(text)
dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/JsFormat/libs/diff_match_patch/python2/diff_match_patch.py/diff_match_patch.diff_toDelta/original