new DeepDiff () new DeepDiff (options)
511086
function DeepDiff () {
  var self = this

  self.klass = DeepDiff;
  self.klass.super_.apply(self, arguments);

  self.engine = require('deep-diff');
}
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})
871021
def deep_diff(self, db_data, user_data):
        
        # NOTE: tcex does include the deepdiff library as a dependencies since it is only
        # required for local testing.
        try:
            from deepdiff import DeepDiff
        except ImportError:
            print('Could not import DeepDiff module (try "pip install deepdiff").')
            sys.exit(1)

        try:
            ddiff = DeepDiff(db_data, user_data, ignore_order=True)
        except KeyError:
            return False
        except NameError:
            return False
        if ddiff:
            self.tcex.log.info(u'[validate] Diff      : {}'.format(ddiff))
            return False
        return True
98488
function simplifyDiffs(acediff, diffs) {
  const groupedDiffs = [];

  function compare(val) {
    return (acediff.options.diffGranularity === C.DIFF_GRANULARITY_SPECIFIC) ? val < 1 : val <= 1;
  }

  diffs.forEach((diff, index) => {
    if (index === 0) {
      groupedDiffs.push(diff);
      return;
    }

    // loop through all grouped diffs. If this new diff lies between an existing one, we'll just add to it, rather
    // than create a new one
    let isGrouped = false;
    for (let i = 0; i < groupedDiffs.length; i++) {
      if (compare(Math.abs(diff.leftStartLine - groupedDiffs[i].leftEndLine)) &&
          compare(Math.abs(diff.rightStartLine - groupedDiffs[i].rightEndLine))) {
        // update the existing grouped diff to expand its horizons to include this new diff start + end lines
        groupedDiffs[i].leftStartLine = Math.min(diff.leftStartLine, groupedDiffs[i].leftStartLine);
        groupedDiffs[i].rightStartLine = Math.min(diff.rightStartLine, groupedDiffs[i].rightStartLine);
        groupedDiffs[i].leftEndLine = Math.max(diff.leftEndLine, groupedDiffs[i].leftEndLine);
        groupedDiffs[i].rightEndLine = Math.max(diff.rightEndLine, groupedDiffs[i].rightEndLine);
        isGrouped = true;
        break;
      }
    }

    if (!isGrouped) {
      groupedDiffs.push(diff);
    }
  });

  // clear out any single line diffs (i.e. single line on both editors)
  const fullDiffs = [];
  groupedDiffs.forEach((diff) => {
    if (diff.leftStartLine === diff.leftEndLine && diff.rightStartLine === diff.rightEndLine) {
      return;
    }
    fullDiffs.push(diff);
  });

  return fullDiffs;
}
684020
function deepMerge (base, custom) {
  Object.keys(custom).forEach(function (key) {
    if (!base.hasOwnProperty(key) || typeof base[key] !== 'object') {
      base[key] = custom[key]
    } else {
      base[key] = deepMerge(base[key], custom[key])
    }
  })

  return base
}
663067
function diffFile(existing, proposed, options) {
  let { ensureContents, exists, readChunk } = utils;
  let opts = options || {};

  let contentsA = existing.contents;
  let contentsB = proposed.contents;

  if (!contentsA && exists(existing)) {
    contentsA = readChunk(existing.path, 0, 4 + 4096);
  }

  if (!contentsB && exists(proposed)) {
    contentsB = readChunk(proposed.path, 0, 4 + 4096);
  }

  if ((contentsA && isBuffer(contentsA)) || (contentsB && isBuffer(contentsB))) {
    return diffBinary(existing, proposed);
  }

  ensureContents(existing);
  ensureContents(proposed);
  if (opts.diffText === true) {
    return diffText(existing.contents.toString(), proposed.contents.toString(), opts);
  }
  return diffChars(existing.contents.toString(), proposed.contents.toString(), opts);
}
739183
def merge_deep(dct1, dct2, merger=None):
    
    my_merger = merger or Merger(
        # pass in a list of tuples,with the
        # strategies you are looking to apply
        # to each type.
        [
            (list, ["append"]),
            (dict, ["merge"])
        ],
        # next, choose the fallback strategies,
        # applied to all other types:
        ["override"],
        # finally, choose the strategies in
        # the case where the types conflict:
        ["override"]
    )
    return my_merger.merge(dct1, dct2)
1235391
def default_distdiff_options(updates=None):
    

    parser = create_optparser()
    options = parser.parse_args(list())

    if updates:
        # pylint: disable=W0212
        options._update_careful(updates)

    return options
286721
function(diff) {
	var ret = [];

	diff.push({ value: '', lines: [] });  // Append an empty value to make cleanup easier

	// Formats a given set of lines for printing as context lines in a patch
	function contextLines(lines) {
		return lines.map(function(entry) { return ' ' + entry; });
	}

	var oldRangeStart = 0;
	var newRangeStart = 0;
	var curRange = [];
	var oldLine = 1;
	var newLine = 1;

	for (var i = 0; i < diff.length; i++) {
		var current = diff[i];
		var lines = current.lines || current.value.replace(/\n$/, '').split('\n');
		current.lines = lines;

		if (current.added || current.removed) {
			// If we have previous context, start with that
			if (!oldRangeStart) {
				var prev = diff[i - 1];
				oldRangeStart = oldLine;
				newRangeStart = newLine;

				if (prev) {
					curRange = contextLines(prev.lines.slice(-4));
					oldRangeStart -= curRange.length;
					newRangeStart -= curRange.length;
				}
			}

			// Output our changes
			curRange.push.apply(curRange, lines.map(function(entry) {
				return (current.added ? '+' : '-') + entry;
			}));

			// Track the updated file position
			if (current.added) {
				newLine += lines.length;
			} else {
				oldLine += lines.length;
			}
		} else {
			// Identical context lines. Track line changes
			if (oldRangeStart) {
				// Close out any changes that have been output (or join overlapping)
				if (lines.length <= 8 && i < diff.length - 2) {
					// Overlapping
					curRange.push.apply(curRange, contextLines(lines));
				} else {
					// end the range and output
					var contextSize = Math.min(lines.length, 4);
					ret.push(
						'@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize)
						+ ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize)
						+ ' @@');
					ret.push.apply(ret, curRange);
					ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));

					oldRangeStart = 0;
					newRangeStart = 0;
					curRange = [];
				}
			}
			oldLine += lines.length;
			newLine += lines.length;
		}
	}

	return ret.join('\n') + '\n';
}
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)
1134276
def split_diff(old, new):
        
        return map(lambda l: l.rstrip(),
                   icdiff.ConsoleDiff(cols=COLUMNS).make_table(old.splitlines(), new.splitlines()))
754233
function flattenDepth (array, depth) {
  if (!Array.isArray(array)) {
    throw new TypeError('Expected value to be an array')
  }

  return flattenFromDepth(array, depth)
}
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;
}
156430
function errorDiff(err, type, escape) {
  var actual   = escape ? escapeInvisibles(err.actual)   : err.actual;
  var expected = escape ? escapeInvisibles(err.expected) : err.expected;
  return diff['diff' + type](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('');
}
903362
def deep_update(d,d_update):
	
	for k,v in list(d_update.items()):
		if isinstance(v,dict):
			if k in d:
				deep_update(d[k],v)
			else:
				d[k]=v
		elif isinstance(d,list):
			d.append({k:v})
		else:
			d[k]=v
	return d
118082
def update_dct(dic1, dic2):
    
    for key, val in dic2.items():
        if isinstance(val, dict):
            dic1.setdefault(key, {})
            update_dct(dic1[key], val)
        else:
            dic1[key] = val
468258
function logDiffText(diff, options) {
    var diffText = getDiffText(diff, options);

    if (diffText) {
        console.log(inverseGreen('+ expected'), inverseRed('- actual'), '\n',  diffText);
    }
}