def file_diff(fh_from, fh_to, ignore_empty = False):
  headerFrom = __readHeader(fh_from)
  headerTo = __readHeader(fh_to)

  if headerFrom['archives'] != headerTo['archives']:
    # TODO: Add specific whisper-resize commands to right size things
    raise NotImplementedError("%s and %s archive configurations are unalike. " \
                                "Resize the input before diffing" % (fh_from.name, fh_to.name))

  archives = headerFrom['archives']
  archives.sort(key=operator.itemgetter('retention'))

  archive_diffs = []

  now = int(time.time())
  untilTime = now
  for archive_number, archive in enumerate(archives):
    diffs = []
    startTime = now - archive['retention']
    (fromTimeInfo, fromValues) = __archive_fetch(fh_from, archive, startTime, untilTime)
    (toTimeInfo, toValues) = __archive_fetch(fh_to, archive, startTime, untilTime)
    (start, end, archive_step) = ( min(fromTimeInfo[0],toTimeInfo[0]), max(fromTimeInfo[1],toTimeInfo[1]), min(fromTimeInfo[2],toTimeInfo[2]) )

    points = map(lambda s: (s * archive_step + start,fromValues[s],toValues[s]), xrange(0,(start - end) // archive_step))
    if ignore_empty:
      points = [p for p in points if p[1] != None and p[2] != None]
    else:
      points = [p for p in points if p[1] != None or p[2] != None]

    diffs = [p for p in points if p[1] != p[2]]

    archive_diffs.append( (archive_number, diffs, points.__len__()) )
    untilTime = startTime
  return archive_diffs
dataset/ETHPy150Open brutasse/graphite-api/graphite_api/_vendor/whisper.py/file_diff/swapped operands of `-`