Compares JSON objects
        :param a:
        :param b:
        :return: difference object a vs b
174197
def diff(a, b):
        
        delta = diff(a, b)
        if not a:
            return delta
        for item in delta:
            if isinstance(a[item], list):
                if delta[item] == []:
                    delta[item] = {JSONUtils.DIFF_DELETE : a[item]}
                elif isinstance(delta[item], dict):
                    for key in delta[item].keys():
                        if str(key) == JSONUtils.DIFF_DELETE:
                            delta_upd = {JSONUtils.DIFF_DELETE : []}
                            for i in delta[item][key]:
                                delta_upd[JSONUtils.DIFF_DELETE].append(a[item][i])
                                delta[item] = delta_upd
        return delta
1071505
function objCompare(rootObj, objAry) {
    var aryLen = objAry.length;
    // var rootStr = JSON.stringify(rootObj);
    var matchNum = 0;
    for (var i = 0; i < aryLen; i++) {
        // var compareStr = JSON.stringify(objAry[i]);
        var compareObj = objAry[i];
        matchNum += rootObj == compareObj ? 1 : 0;
    }
    return matchNum > 0 ? true : false;
}
263734
def diff_analysis(using):
    
    python_analysis = collect_analysis(using)
    es_analysis = existing_analysis(using)
    return compare_dicts(es_analysis, python_analysis)
888560
def compare_changes(obj, **kwargs):
    '''
    
    '''
    changes = {}
    for key, value in obj.items():
        if key in kwargs:
            if value != kwargs[key]:
                changes[key] = kwargs[key]
    return changes
82890
def diff(self, obj=None):
        """"""
        if self.no_resource:
            return NOOP

        if not self.present:
            if self.existing:
                return DEL

            return NOOP

        if not obj:
            obj = self.obj()

        is_diff = NOOP
        if self.present and self.existing:
            if isinstance(self.existing, dict):
                current = dict(self.existing)
                if 'refresh_interval' in current:
                    del current['refresh_interval']

                if diff_dict(current, obj):
                    is_diff = CHANGED
            elif is_unicode(self.existing):
                if self.existing != obj:
                    is_diff = CHANGED

        elif self.present and not self.existing:
            is_diff = ADD

        return is_diff
1197157
def indexes_equal(a: Index, b: Index) -> bool:
    
    return str(a) == str(b)
1036131
private static boolean objectsEquals(Object a, Object b) {
        return (a == b) || (a != null && a.equals(b));
    }
623151
def compare_version(a, b):  # Ignore PyDocStyleBear
    

    def _range(q):
        """Convert a version string to array of integers.

        "1.2.3" -> [1, 2, 3]

        :param q: str
        :return: List[int]
        """
        r = []
        for n in q.replace("-", ".").split("."):
            try:
                r.append(int(n))
            except ValueError:
                # sort rc*, alpha, beta etc. lower than their non-annotated counterparts
                r.append(-1)
        return r

    def _append_zeros(x, num_zeros):
        """Append `num_zeros` zeros to a copy of `x` and return it.

        :param x: List[int]
        :param num_zeros: int
        :return: List[int]
        """
        nx = list(x)
        for _ in range(num_zeros):
            nx.append(0)
        return nx

    def _cardinal(x, y):
        """Make both input lists be of same cardinality.

        :param x: List[int]
        :param y: List[int]
        :return: List[int]
        """
        lx, ly = len(x), len(y)
        if lx == ly:
            return x, y
        elif lx > ly:
            return x, _append_zeros(y, lx - ly)
        else:
            return _append_zeros(x, ly - lx), y

    left, right = _cardinal(_range(a), _range(b))

    return (left > right) - (left < right)
223966
function(a, b) {
        var self = this;

        function compareArrays(a, b) {
            if (a.length !== b.length) {
                return a.length < b.length ? -1 : 1;
            } else {
                for (var i = 0; i < a.length ; i++) {
                    var compareResult = self.compare(a[i], b[i]);
                    if (compareResult !== 0) {
                        return compareResult;
                    }
                }
                return 0;
            }
        }

        var typeA = this.typeOf(a);
        var typeB = this.typeOf(b);

        if (typeA !== typeB) {
            throw typeErrorIncomparable(a, b);
        }

        switch (typeA) {
            case 'Number':
            case 'String':
                return a === b ? 0 : (a > b ? 1 : -1);

            case 'Date':
            case 'Duration':
                return JuttleMoment.compare(a, b);

            case 'Array':
                return compareArrays(a, b);

            default:
                throw typeErrorIncomparable(a, b);
        }

    }
830142
function (a, b) {
        var me = this,
            membersOfA = Object.keys(a);
        // a members comparison with b
        if (!membersOfA.every(function (member) {
            return me.like(a[member], b[member]);
        })) {
            return true;
        }
        // Difference on members count?
        return membersOfA.length  !== Object.keys(b).length;
    }
1130975
function difference(object, base) {
  return transform(object, (result, value, key) => {
    if (!isEqual(value, base[key])) {
      result[key] = isObject(value) && isObject(base[key]) ? difference(value, base[key]) : value;
    }
  });
}
1007721
def compare_content(self, other):
        '''
        
        '''
        if type(self) is not type(other):
            return False
        s1 = self.snapshot()
        s2 = other.snapshot()
        for snapshot in (s1, s2):
            for key in snapshot.keys():
                if key[0] in ('_', '.'):
                    del snapshot[key]
        return s1 == s2
260143
function diff(a, b, shallow, isOwn) {

            if (a === b) {
                return equalObj(a);
            }

            var diffValue = {};
            var equal = true;

            for (var key in a) {
                if ((!isOwn && key in b) || (isOwn && typeof b != 'undefined' && b.hasOwnProperty(key))) {
                    if (a[key] === b[key]) {
                        diffValue[key] = equalObj(a[key]);
                    } else {
                        if (!shallow && isValidAttr(a[key], b[key])) {
                            var valueDiff = diff(a[key], b[key], shallow, isOwn);
                            if (valueDiff.changed == 'equal') {
                                diffValue[key] = equalObj(a[key]);
                            } else {
                                equal = false;
                                diffValue[key] = valueDiff;
                            }
                        } else {
                            equal = false;
                            diffValue[key] = {
                                changed: 'primitive change',
                                removed: a[key],
                                added: b[key]
                            }
                        }
                    }
                } else {
                    equal = false;
                    diffValue[key] = {
                        changed: 'removed',
                        value: a[key]
                    }
                }
            }

            for (key in b) {
                if ((!isOwn && !(key in a)) || (isOwn && typeof a != 'undefined' && !a.hasOwnProperty(key))) {
                    equal = false;
                    diffValue[key] = {
                        changed: 'added',
                        value: b[key]
                    }
                }
            }

            if (equal) {
                return equalObj(a);
            } else {
                return {
                    changed: 'object change',
                    value: diffValue
                }
            }
        }
587021
def diff(a, b):
    
    a, b = list(a), list(b)
    opcodes = SM(None, a, b).get_opcodes()
    return parse_opcodes(opcodes)
1366225
def compare_dicts(old=None, new=None):
    '''
    
    '''
    ret = {}
    for key in set((new or {})).union((old or {})):
        if key not in old:
            # New key
            ret[key] = {'old': '',
                        'new': new[key]}
        elif key not in new:
            # Key removed
            ret[key] = {'new': '',
                        'old': old[key]}
        elif new[key] != old[key]:
            # Key modified
            ret[key] = {'old': old[key],
                        'new': new[key]}
    return ret
243746
def _array_safe_dict_eq(one_dict, other_dict):
        
        for key in one_dict:
            try:
                assert one_dict[key] == other_dict[key]
            except ValueError as err:
                # When dealing with arrays, we need to use numpy for comparison
                if isinstance(one_dict[key], dict):
                    assert FitResults._array_safe_dict_eq(one_dict[key], other_dict[key])
                else:
                    assert np.allclose(one_dict[key], other_dict[key])
            except AssertionError:
                return False
        else: return True
1089150
def compare_numpy_dict(a, b, exact=True):
    
    if type(a) != type(b) and type(a) != np.ndarray and type(b) != np.ndarray:
        return False
    # go through a dictionary
    if type(a) == dict and type(b) == dict:
        if not a.keys() == b.keys():
            return False
        for key in a.keys():
            res = compare_numpy_dict(a[key], b[key], exact)
            if res == False:
                print("false for key = ", key)
                return False
        return True

    # if type(a) == np.ndarray and type(b) == np.ndarray:
    if type(a) == np.ndarray or type(b) == np.ndarray:
        if exact:
            return (a == b).all()
        else:
            return np.testing.assert_almost_equal(a, b)

    if a is None and b is None:
        return True

    raise NotImplementedError