Saves the visual diff as a separate file
559717
def save_visual_diff(org, fresh)
      x, y = @diff_index.map{ |xy| xy[0] }, @diff_index.map{ |xy| xy[1] }
      @diffed_image = org.insert(-5, '_diff')

      begin
        @images.last.rect(x.min, y.min, x.max, y.max, ChunkyPNG::Color.rgb(0,255,0))
      rescue NoMethodError
        puts "Both skins are the same.".color(:yellow)
      end
      
      @images.last.save(@diffed_image)
    end
1195043
def diff(context, file_name):
    """"""
    context.obj.find_repo_type()
    if context.obj.vc_name == 'git':
        context.obj.call(['git', 'diff', '--color-words',
                          '--ignore-space-change', file_name])
    elif context.obj.vc_name == 'hg':
        context.obj.call(['hg', 'diff', file_name])
156920
def diff_files(from_file, to_file, index_columns, sep=',', ignored_columns=None):
    
    with open(from_file) as from_stream:
        with open(to_file) as to_stream:
            from_records = records.load(from_stream, sep=sep)
            to_records = records.load(to_stream, sep=sep)
            return patch.create(from_records, to_records, index_columns,
                                ignore_columns=ignored_columns)
467625
def diff(self, filename, wildcard='*'):
        ''''''
        other = MAVParmDict()
        if not other.load(filename):
            return
        keys = sorted(list(set(self.keys()).union(set(other.keys()))))
        for k in keys:
            if not fnmatch.fnmatch(str(k).upper(), wildcard.upper()):
                continue
            if not k in other:
                print("%-16.16s              %12.4f" % (k, self[k]))
            elif not k in self:
                print("%-16.16s %12.4f" % (k, other[k]))
            elif abs(self[k] - other[k]) > self.mindelta:
                print("%-16.16s %12.4f %12.4f" % (k, other[k], self[k]))
470786
def __generic_save_as(self):
        """"""
        page = self._get_page()
        if not page.editor.f:
            return True
        if page.editor.f.filename:
            d = page.editor.f.filename
        else:
            d = os.path.join(self.save_dir if self.save_dir is not None \
                                 else self.load_dir if self.load_dir is not None \
                else ".", page.editor.f.default_filename)
        new_filename = QFileDialog.getSaveFileName(self, page.make_text_saveas(), d, page.wild)[0]
        if new_filename:
            self.save_dir, _ = os.path.split(str(new_filename))
            page.editor.f.save_as(str(new_filename))
            page.flag_changed = False
            self._update_gui_text_tabs()
            page.editor.update_gui_label_fn()
            return True
        return False
1349701
def save(self, filename):
        ''''''
        f = open(filename, mode='w')
        f.write("QGC WPL 110\n")
        for w in self.wpoints:
            if getattr(w, 'comment', None):
                f.write("# %s\n" % w.comment)
            f.write("%u\t%u\t%u\t%u\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%u\n" % (
                w.seq, w.current, w.frame, w.command,
                w.param1, w.param2, w.param3, w.param4,
                w.x, w.y, w.z, w.autocontinue))
        f.close()
828272
def diff(self):
        

        self._copyfiles = False
        self._updatefiles = False
        self._purge = False
        self._creatdirs = False
        self._updatefiles = False

        self.log('Difference of directory %s from %s\n' %
                 (self._dir2, self._dir1))
        self._diff(self._dir1, self._dir2)
1164347
def save(self, filename):
        
        with open(filename, "wb") as fd:
            fd.write(self.__buff)
832770
def save(cls,instance,filename):
        """"""
        filename = cls.correct_file_extension(filename)
        try:
            with open(filename,'wb') as f:
                pickle.dump(instance,f,protocol=pickle.HIGHEST_PROTOCOL)
        except MemoryError as e:
            print ('{} occurred, will downsampled the saved file by 20.'
                   .format(type(e).__name__))
            copy_instance = instance.copy()
            copy_instance.H = copy_instance.H[::20,:,:]
            copy_instance.Y = copy_instance.Y[::20,:]
            with open(filename,'wb') as f:
                pickle.dump(copy_instance,f,protocol=pickle.HIGHEST_PROTOCOL)
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)
439887
def save_as(self):
        """"""
        editorstack = self.get_current_editorstack()
        if editorstack.save_as():
            fname = editorstack.get_current_filename()
            self.__add_recent_file(fname)
198649
def download_diffs(queue):
    """"""
    while True:
        options, signature_type, localver, remotever = queue.get()
        for num in range(int(localver), int(remotever) + 1):
            sig_diff = '%s-%d' % (signature_type, num)
            filename = os.path.join(options.mirrordir, '%s.cdiff' % sig_diff)
            if not os.path.exists(filename):
                update_diff(options, sig_diff)
        queue.task_done()
377837
def _diff_internal(d1,d2):
    '''
        
    '''
    same =[]
    kdiff =[]
    vdiff = []
    for key in d1:
        value = d1[key]
        if(key in d2):
            if(value == d2[key]):
                same.append(key)
            else:
                vdiff.append(key)
        else:
            kdiff.append(key)
    return({'same':same,'kdiff':kdiff,'vdiff':vdiff})
578888
function unifiedDiff (err) {
  let indent = '      '
  function cleanUp (line) {
    if (line[0] === '+') {
      return indent + format.colorLines('green', line)
    }
    if (line[0] === '-') {
      return indent + format.colorLines('red', line)
    }
    if (line.match(/@@/)) {
      return null
    }
    if (line.match(/\\ No newline/)) {
      return null
    }
    if (line.trim().length) {
      line = format.colorLines('white', line)
    }
    return indent + line
  }
  function notBlank (line) {
    return typeof line !== 'undefined' && line !== null
  }
  let msg = diff.createPatch('string', err.actual, err.expected)
  let lines = msg.split('\n').splice(4)
  let diffResult = lines.map(cleanUp).filter(notBlank).join('\n')
  if (!diffResult.trim().length) {
    msg = diff.createPatch(
      'string',
      stringify(Object.keys(err._actual || err.actual).sort()),
      stringify(Object.keys(err._expected || err.expected).sort())
    )
    lines = msg.split('\n').splice(4)
    diffResult = format.red('       object keys not match: \n') + lines.map(cleanUp).filter(notBlank).join('\n')
  }
  return '\n      ' +
    format.colorLines('green', '+ expected') + ' ' +
    format.colorLines('red', '- actual') +
    '\n\n' +
    diffResult
}
583492
def diff_archives(archive1, archive2, verbosity=0, interactive=True):
    """"""
    util.check_existing_filename(archive1)
    util.check_existing_filename(archive2)
    if verbosity >= 0:
        util.log_info("Comparing %s with %s ..." % (archive1, archive2))
    res = _diff_archives(archive1, archive2, verbosity=verbosity, interactive=interactive)
    if res == 0 and verbosity >= 0:
        util.log_info("... no differences found.")
1075184
function prettifyDiffObj(diff) {
    const obj = {
        kind: undefined,
        path: undefined,
        expect: undefined,
        actual: undefined,
        index: undefined,
        item: undefined,
    };
    if (diff.kind) {
        switch (diff.kind) {
            case 'N':
                obj.kind = 'New';
                break;
            case 'D':
                obj.kind = 'Missing';
                break;
            case 'E':
                obj.kind = 'Changed';
                break;
            case 'A':
                obj.kind = 'Array Canged';
                break;
        }
    }
    if (diff.path) {
        let path = diff.path[0];
        for (let i = 1; i < diff.path.length; i++) {
            path += `/${diff.path[i]}`;
        }
        obj.path = path;
    }
    if (typeof diff.lhs !== 'undefined') {
        obj.expect = diff.lhs;
    }
    if (typeof diff.rhs !== 'undefined') {
        obj.actual = diff.rhs;
    }
    if (diff.index) {
        obj.index = diff.index;
    }
    if (diff.item) {
        obj.item = prettifyDiffObj(diff.item);
    }
    return obj;
}
441814
def _make_diff(self, correct, given):
        """"""
        dmp = DMP()
        dmp.Diff_Timeout = 4
        text1, text2, array = dmp.diff_linesToChars(correct, given)
        diffs = dmp.diff_main(text1, text2)
        dmp.diff_cleanupSemantic(diffs)
        dmp.diff_charsToLines(diffs, array)
        return list(dmp_to_mdiff(diffs))