Checks a diff for validity.

This is here only for debugging purposes.
491141
function _check($from_lines, $to_lines)
    {
        if (serialize($from_lines) != serialize($this->getOriginal())) {
            trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
        }
        if (serialize($to_lines) != serialize($this->getFinal())) {
            trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
        }

        $rev = $this->reverse();
        if (serialize($to_lines) != serialize($rev->getOriginal())) {
            trigger_error("Reversed original doesn't match", E_USER_ERROR);
        }
        if (serialize($from_lines) != serialize($rev->getFinal())) {
            trigger_error("Reversed final doesn't match", E_USER_ERROR);
        }

        $prevtype = null;
        foreach ($this->_edits as $edit) {
            if ($prevtype == get_class($edit)) {
                trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
            }
            $prevtype = get_class($edit);
        }

        return true;
    }
231717
def raw_diff(self):
        
        udiff_copy = self.copy_iterator()
        if self.__format == 'gitdiff':
            udiff_copy = self._parse_gitdiff(udiff_copy)
        return u''.join(udiff_copy)
276157
def diff_since(time)
      other_audit = auditable.audits.where("created_at <= ? AND id != ?", time, id).order("id DESC").limit(1).first

      diff(other_audit)
    end
179229
def check(self, version):  # Ignore PyDocStyleBear
        

        def _compare_spec(spec):
            if len(spec) == 1:
                spec = ("=", spec[0])

            token = Tokens.operators.index(spec[0])
            comparison = compare_version(version, spec[1])
            if token in [Tokens.EQ1, Tokens.EQ2]:
                return comparison == 0
            elif token == Tokens.GT:
                return comparison == 1
            elif token == Tokens.LT:
                return comparison == -1
            elif token == Tokens.GTE:
                return comparison >= 0
            elif token == Tokens.LTE:
                return comparison <= 0
            elif token == Tokens.NEQ:
                return comparison != 0
            else:
                raise ValueError("Invalid comparison token")

        results, intermediaries = False, False
        for spec in self.spec:
            if isinstance(spec, list):
                intermediary = True
                for sub in spec:
                    intermediary &= _compare_spec(sub)
                intermediaries |= intermediary
            elif isinstance(spec, tuple):
                results |= _compare_spec(spec)

        return results or intermediaries
79907
def _diff(d1,d2):
    '''
        
    '''
    d = {}
    ds = _diff_internal(d1,d2)
    for key in ds['vdiff']:
        d[key] = d1[key]
    for key in ds['kdiff']:
        d[key] = d1[key]
    return(d)
134812
private static boolean doEquals(DerValue d1, DerValue d2) {
        synchronized (d1.data) {
            synchronized (d2.data) {
                d1.data.reset();
                d2.data.reset();
                return d1.buffer.equals(d2.buffer);
            }
        }
    }
599741
def compare_data(self, data):
        '''
        
        '''
        if self.old_data != data:
            self.old_data = data
            return True
        return False
396602
def diff(self):
        
        latest = self.latest
        current = NetJsonParser(self.json())
        return diff(current, latest)
595912
public int differenceFound(Difference difference) {
        final int returnValue = super.differenceFound(difference);
        switch (returnValue) {
        case RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL:
            return returnValue;
        case RETURN_ACCEPT_DIFFERENCE:
            break;
        case RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR:
            difference.setRecoverable(true);
            break;
        case RETURN_UPGRADE_DIFFERENCE_NODES_DIFFERENT:
            difference.setRecoverable(false);
            break;
        default:
            throw new IllegalArgumentException(returnValue
                                               + " is not a defined "
                                               + " DifferenceListener"
                                               + ".RETURN_... value");
        }
        allDifferences.add(difference);
        return returnValue;
    }
199619
def _check_cell_validity(self, i, j):
        
        if i >= len(self._output):
            return True
        if j >= len(self._output[i]):
            return True
        if self._output[i][j] is None:
            return True
        return False
382531
def check(self, diff):
        
        relative_path = relative_to_contrib(diff, self.project)
        assert len(relative_path.parts) == 2
419593
def diff_record(self, record):
        """"""
        rec = self.get_record(record._record_type, record.host)
        if rec is not None and record is not None:
            return {'removed': tuple(set(rec.results) - set(record.results)),
                    'added': tuple(set(record.results) - set(rec.recults))}
        else:
            return False
796721
def diff(self):
        """"""
        done = set(self.done)
        return [name for name in self.todo if name not in done]
1346043
def check_impl(self):
        

        c = False
        for change in self.collect():
            change.check()
            c = c or change.is_change()
        return c, None
235651
def _diff(self):
        """"""
        j_cs = self.j['checksum_type']
        j_feed = self.j['feed']

        p_cs = self.p['checksum_type']
        p_feed = self.p['feed']

        # checksum is a distributor property
        # Is the pulp checksum wrong?
        if not p_cs == j_cs:
            juicer.utils.Log.log_debug("Pulp checksum_type does not match juicer")
            self.distributor_diff['distributor_config']['checksum_type'] = j_cs
            juicer.utils.Log.log_debug("distributor_config::checksum_type SHOULD BE %s" % j_cs)

        # feed is an importer property
        if not p_feed == j_feed:
            juicer.utils.Log.log_debug("Pulp feed does not match juicer")
            self.importer_diff['importer_config']['feed'] = j_feed
            juicer.utils.Log.log_debug("importer_config::feed SHOULD BE %s" % j_feed)
1053749
def compare(self, node, prev_value=None, prev_index=None):
        
        if prev_value is not None and node.value != prev_value or \
           prev_index is not None and node.index != prev_index:
            raise TestFailed(index=self.index)
1102454
function errorDiff(actual, expected) {
  return diff
    .diffWordsWithSpace(actual, expected)
    .map(function(str) {
      if (str.added) {
        return colorLines('diff added', str.value);
      }
      if (str.removed) {
        return colorLines('diff removed', str.value);
      }
      return str.value;
    })
    .join('');
}