Determine the diff of two strings.  Return an empty string if the strings
    are identical, and the diff output string if they are not.
971444
def diff_string_templates(string_a, string_b):
    
    s1 = string_a.strip().splitlines()
    s2 = string_b.strip().splitlines()
    diffs = unified_diff(s2, s1, fromfile='deployed', tofile='local', lineterm='')
    return '\n'.join(diffs)
80108
function getSingleDiffInfo(editor, offset, diffString) {
  const info = {
    startLine: 0,
    startChar: 0,
    endLine: 0,
    endChar: 0,
  };
  const endCharNum = offset + diffString.length;
  let runningTotal = 0;
  let startLineSet = false,
    endLineSet = false;

  editor.lineLengths.forEach((lineLength, lineIndex) => {
    runningTotal += lineLength;

    if (!startLineSet && offset < runningTotal) {
      info.startLine = lineIndex;
      info.startChar = offset - runningTotal + lineLength;
      startLineSet = true;
    }

    if (!endLineSet && endCharNum <= runningTotal) {
      info.endLine = lineIndex;
      info.endChar = endCharNum - runningTotal + lineLength;
      endLineSet = true;
    }
  });

  // if the start char is the final char on the line, it's a newline & we ignore it
  if (info.startChar > 0 && getCharsOnLine(editor, info.startLine) === info.startChar) {
    info.startLine++;
    info.startChar = 0;
  }

  // if the end char is the first char on the line, we don't want to highlight that extra line
  if (info.endChar === 0) {
    info.endLine--;
  }

  const endsWithNewline = /\n$/.test(diffString);
  if (info.startChar > 0 && endsWithNewline) {
    info.endLine++;
  }

  return info;
}
179024
def _get_diff_text(old, new):
    '''
    
    '''
    diff = difflib.unified_diff(old.splitlines(1),
                                new.splitlines(1))
    return ''.join([x.replace('\r', '') for x in diff])
1352917
def is_equal(self, string1, string2):
        '''  '''
        return string1.lower().strip() == string2.lower().strip()
411538
def diff(self, first_row: List[Row], second_row: List[Row], column: NumberColumn) -> Number:
        
        if not first_row or not second_row:
            return 0.0  # type: ignore
        first_value = first_row[0].values[column.name]
        second_value = second_row[0].values[column.name]
        if isinstance(first_value, float) and isinstance(second_value, float):
            return first_value - second_value  # type: ignore
        else:
            raise ExecutionError(f"Invalid column for diff: {column.name}")
769489
public static int versionCompare(String str1, String str2) {
        String[] vals1 = str1.split("\\.");
        String[] vals2 = str2.split("\\.");
        int i = 0;
        // set index to first non-equal ordinal or length of shortest version string
        while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) {
            i++;
        }
        // compare first non-equal ordinal number
        if (i < vals1.length && i < vals2.length) {
            int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i]));
            return Integer.signum(diff);
        }
        // the strings are equal or one string is a substring of the other
        // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
        return Integer.signum(vals1.length - vals2.length);
    }
1005525
def diff(cls, a, b, ignore_formatting=False):
        """"""
        def underline(x): return u'\x1b[4m%s\x1b[0m' % (x,)
        def blink(x): return u'\x1b[5m%s\x1b[0m' % (x,)
        a_rows = []
        b_rows = []
        max_width = max([len(row) for row in a] + [len(row) for row in b])
        a_lengths = []
        b_lengths = []
        for a_row, b_row in zip(a, b):
            a_lengths.append(len(a_row))
            b_lengths.append(len(b_row))
            extra_a = u'`' * (max_width - len(a_row))
            extra_b = u'`' * (max_width - len(b_row))
            a_line = u''
            b_line = u''
            for a_char, b_char in zip(a_row + extra_a, b_row + extra_b):
                if ignore_formatting:
                    a_char_for_eval = a_char.s if isinstance(a_char, FmtStr) else a_char
                    b_char_for_eval = b_char.s if isinstance(b_char, FmtStr) else b_char
                else:
                    a_char_for_eval = a_char
                    b_char_for_eval = b_char
                if a_char_for_eval == b_char_for_eval:
                    a_line += actualize(a_char)
                    b_line += actualize(b_char)
                else:
                    a_line += underline(blink(actualize(a_char)))
                    b_line += underline(blink(actualize(b_char)))
            a_rows.append(a_line)
            b_rows.append(b_line)
        hdiff = '\n'.join(a_line + u' %3d | %3d ' % (a_len, b_len) + b_line for a_line, b_line, a_len, b_len in zip(a_rows, b_rows, a_lengths, b_lengths))
        return hdiff
130817
function diff(a, b) {
  var diff = {};
  var key;
  for (key in b) { if (b.hasOwnProperty(key) && b[key] !== a[key]) { diff[key] = b[key]; }}
  for (key in a) { if (a.hasOwnProperty(key) && !(key in b)) { diff[key] = undefined; }}
  return diff;
}
1354435
def _diff_text(left, right, verbose=False):
    
    from difflib import ndiff
    explanation = []
    if isinstance(left, py.builtin.bytes):
        left = u(repr(left)[1:-1]).replace(r'\n', '\n')
    if isinstance(right, py.builtin.bytes):
        right = u(repr(right)[1:-1]).replace(r'\n', '\n')
    if not verbose:
        i = 0  # just in case left or right has zero length
        for i in range(min(len(left), len(right))):
            if left[i] != right[i]:
                break
        if i > 42:
            i -= 10                 # Provide some context
            explanation = [u('Skipping %s identical leading '
                             'characters in diff, use -v to show') % i]
            left = left[i:]
            right = right[i:]
        if len(left) == len(right):
            for i in range(len(left)):
                if left[-i] != right[-i]:
                    break
            if i > 42:
                i -= 10     # Provide some context
                explanation += [u('Skipping %s identical trailing '
                                  'characters in diff, use -v to show') % i]
                left = left[:-i]
                right = right[:-i]
    keepends = True
    explanation += [line.strip('\n')
                    for line in ndiff(left.splitlines(keepends),
                                      right.splitlines(keepends))]
    return explanation
162340
def difference(cls, first, second):
        """"""

        # so we always get a Rank instance even if string were passed in
        first, second = cls(first), cls(second)
        rank_list = list(cls)
        return abs(rank_list.index(first) - rank_list.index(second))
473074
def get_diff(original, fixed, file_name,
             original_label='original', fixed_label='fixed'):
    """"""
    original, fixed = original.splitlines(True), fixed.splitlines(True)
    newline = '\n'

    from difflib import unified_diff
    diff = unified_diff(original, fixed,
                        os.path.join(original_label, file_name),
                        os.path.join(fixed_label, file_name),
                        lineterm=newline)
    text = ''
    for line in diff:
        text += line
        # Work around missing newline (http://bugs.python.org/issue2142).
        if not line.endswith(newline):
            text += newline + r'\ No newline at end of file' + newline
    return text
646001
def word_diff(a,b):
  ''
  return translate_diff(a,rediff(splitpreserve(a),splitpreserve(b)))
406172
def checkdiff(a,b,sp=True):
  ''
  if sp: a=splitpreserve(a); b=splitpreserve(b)
  res=applydiff(a,rediff(a,b))
  if sp: res=''.join(res)
  return res
187369
def _get_diffs(cls, dict1, dict2, ignore_missing_keys):
        '''
        
        '''
        ret_dict = {}
        for p in dict1.keys():
            if p not in dict2:
                ret_dict.update({p: {'new': dict1[p], 'old': cls.NONE_VALUE}})
            elif dict1[p] != dict2[p]:
                if isinstance(dict1[p], dict) and isinstance(dict2[p], dict):
                    sub_diff_dict = cls._get_diffs(dict1[p], dict2[p],
                                                   ignore_missing_keys)
                    if sub_diff_dict:
                        ret_dict.update({p: sub_diff_dict})
                else:
                    ret_dict.update({p: {'new': dict1[p], 'old': dict2[p]}})
        if not ignore_missing_keys:
            for p in dict2.keys():
                if p not in dict1.keys():
                    ret_dict.update({p: {'new': cls.NONE_VALUE,
                                         'old': dict2[p]}})
        return ret_dict
666217
def inline_diff(line, start, ending)
        if start != 0 || ending != 0
          last = ending + line.length
          str = line[0...start] + '\0' + line[start...last] + '\1' + line[last...line.length]
        end
        str || line
      end
1337344
def array_diff(array1, array2, format = :text)
    string1 = array1.join("\n") + "\n"
    string2 = array2.join("\n") + "\n"
    Diffy::Diff.new(string1, string2).to_s(format)
  end
618822
def equals_log_diff(expected, actual, level=logging.ERROR):
  """"""
  if expected == actual:
    return True

  # Output the diff first.
  logging.log(level, '***** Data mismatch: *****')
  for line in difflib.unified_diff(
      expected.splitlines(), actual.splitlines(),
      fromfile='expected', tofile='actual', lineterm=''):
    logging.log(level, line)
  logging.log(level, '^^^^^  Data diff  ^^^^^')