Returns True iff 'a' contains the same elements as 'b', irrespective of their order.
        # TODO: Python 2.4 has a proper set class.
507579
def equal (a, b):
    
    assert is_iterable(a)
    assert is_iterable(b)
    return contains (a, b) and contains (b, a)
602385
function areThingsEqual (a, b) {
  var aKeys , bKeys , i;

  // Strings, booleans, numbers, null
  if (a === null || typeof a === 'string' || typeof a === 'boolean' || typeof a === 'number' ||
      b === null || typeof b === 'string' || typeof b === 'boolean' || typeof b === 'number') { return a === b; }

  // Dates
  if (util.isDate(a) || util.isDate(b)) { return util.isDate(a) && util.isDate(b) && a.getTime() === b.getTime(); }

  // Arrays (no match since arrays are used as a $in)
  // undefined (no match since they mean field doesn't exist and can't be serialized)
  if ((!(util.isArray(a) && util.isArray(b)) && (util.isArray(a) || util.isArray(b))) || a === undefined || b === undefined) { return false; }

  // General objects (check for deep equality)
  // a and b should be objects at this point
  try {
    aKeys = Object.keys(a);
    bKeys = Object.keys(b);
  } catch (e) {
    return false;
  }

  if (aKeys.length !== bKeys.length) { return false; }
  for (i = 0; i < aKeys.length; i += 1) {
    if (bKeys.indexOf(aKeys[i]) === -1) { return false; }
    if (!areThingsEqual(a[aKeys[i]], b[aKeys[i]])) { return false; }
  }
  return true;
}
1266739
def index_lists_equal(a: List[Index], b: List[Index]) -> bool:
    
    n = len(a)
    if len(b) != n:
        return False
    for i in range(n):
        if not indexes_equal(a[i], b[i]):
            log.debug("Mismatch: {!r} != {!r}", a[i], b[i])
            return False
    return True
934709
function isSubsetOf(subset, superset, cmp, contains, ordered) {
    if (!contains) {
      if (subset.length !== superset.length) return false;
      superset = superset.slice();
    }

    return subset.every(function(elem, idx) {
      if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];

      if (!cmp) {
        var matchIdx = superset.indexOf(elem);
        if (matchIdx === -1) return false;

        // Remove match from superset so not counted twice if duplicate in subset.
        if (!contains) superset.splice(matchIdx, 1);
        return true;
      }

      return superset.some(function(elem2, matchIdx) {
        if (!cmp(elem, elem2)) return false;

        // Remove match from superset so not counted twice if duplicate in subset.
        if (!contains) superset.splice(matchIdx, 1);
        return true;
      });
    });
  }
921652
def _element_equal(x, y):
    
    if isinstance(x, _np.ndarray) or isinstance(y, _np.ndarray):
        try:
            return (abs(_np.asarray(x) - _np.asarray(y)) < 1e-5).all()
        except:
            return False
    elif isinstance(x, dict):
        return (isinstance(y, dict)
                and _element_equal(x.keys(), y.keys())
                and all(_element_equal(x[k], y[k]) for k in x.keys()))
    elif isinstance(x, float):
        return abs(x - y) < 1e-5 * (abs(x) + abs(y))
    elif isinstance(x, (list, tuple)):
        return x == y
    else:
        return bool(x == y)
1131479
def difference (b, a):
    
    a = set(a)
    result = []
    for item in b:
        if item not in a:
            result.append(item)
    return result
912213
def does_match_definition(given, main, secondary):
    """"""
    assert isinstance(secondary, tuple)
    assert len(secondary) == 2  # general solution could be provided
    types = decompose_type(given)

    if isinstance(types[0], main):
        return True

    if len(types) >= 2:
        cond1 = isinstance(types[0], main)
        cond2 = isinstance(types[1], secondary)
        cond3 = isinstance(types[1], main)
        cond4 = isinstance(types[0], secondary)
        if (cond1 and cond2) or (cond3 and cond4):
            return True

        if len(types) >= 3:
            classes = set([tp.__class__ for tp in types[:3]])
            desired = set([main] + list(secondary))
            diff = classes.symmetric_difference(desired)
            if not diff:
                return True
            if len(diff) == 2:
                items = list(diff)
                return (
                    issubclass(
                        items[0], items[1]) or issubclass(items[1], items[0]))
            return False
    else:
        return False
348444
function(a, b)
	{
		if ((a == null && b != null) || (a != null && b == null) ||
			(a != null && b != null && a.length != b.length))
		{
			return false;
		}
		else if (a != null && b != null)
		{
			for (var i = 0; i < a.length; i++)
			{
				if (a[i] == b[i] || (a[i] != null && !a[i].equals(b[i])))
				{
					return false;
				}
			}
		}
		
		return true;
	}
373050
public static boolean areEqual(Object o1, Object o2) {
        return
            !o1.getClass().isArray() ? o1.equals(o2) :
                o1.getClass() == boolean[].class ? Arrays.equals((boolean[]) o1, (boolean[]) o2) :
                    o1.getClass() == byte[].class ? Arrays.equals((byte[]) o1, (byte[]) o2) :
                        o1.getClass() == char[].class ? Arrays.equals((char[]) o1, (char[]) o2) :
                            o1.getClass() == double[].class ? Arrays.equals(
                                (double[]) o1,
                                (double[]) o2
                            ) :
                                o1.getClass() == float[].class ? Arrays.equals(
                                    (float[]) o1,
                                    (float[]) o2
                                ) :
                                    o1.getClass() == int[].class ? Arrays.equals(
                                        (int[]) o1,
                                        (int[]) o2
                                    ) :
                                        o1.getClass() == long[].class ? Arrays.equals(
                                            (long[]) o1,
                                            (long[]) o2
                                        ) :
                                            o1.getClass() == short[].class ? Arrays.equals(
                                                (short[]) o1,
                                                (short[]) o2
                                            ) :
                                                Arrays.equals(
                                                    (Object[]) o1,
                                                    (Object[]) o2
                                                );
    }
1234584
def equal(self, value_a, value_b):                                         #pylint: disable=no-self-use
        
        equal = value_a == value_b
        if hasattr(equal, '__iter__'):
            return all(equal)
        return equal
950952
private boolean isEqual(Object a, Object b) {

        if (a == null) {
            return (b == null);
        }
        if (b == null) {
            return false;
        }
        return a.equals(b);
    }
151093
public static boolean areEqual(byte[] a, byte[] b) {
        int aLength = a.length;
        if (aLength != b.length) {
            return false;
        }

        for (int i = 0; i < aLength; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }
        return true;
    }
33980
def equal_set(self, a, b):
        ""
        if len(a) != len(b):
            return 0
        if a == b:
            return 1
        return self.subset(a, b) and self.subset(b, a)
925981
function looseEqual (a, b) {
	  /* eslint-disable eqeqeq */
	  return a == b || (
	    isObject(a) && isObject(b)
	      ? JSON.stringify(a) === JSON.stringify(b)
	      : false
	  )
	  /* eslint-enable eqeqeq */
	}
1294174
function isEqual(a, b, stack) {
  var aClass, bClass;
  if (a === b) {
    // Return quickly up front when matched by reference,
    // but be careful about 0 !== -0.
    return a !== 0 || 1 / a === 1 / b;
  }
  aClass = classToString(a);
  bClass = classToString(b);
  if (aClass !== bClass) {
    return false;
  }

  if (isSerializable(a, aClass) && isSerializable(b, bClass)) {
    return objectIsEqual(a, b, aClass, stack);
  } else if (isSet(a, aClass) && isSet(b, bClass)) {
    return a.size === b.size && isEqual(setToArray(a), setToArray(b), stack);
  } else if (isMap(a, aClass) && isMap(b, bClass)) {
    return a.size === b.size && isEqual(mapToArray(a), mapToArray(b), stack);
  } else if (isError(a, aClass) && isError(b, bClass)) {
    return a.toString() === b.toString();
  }

  return false;
}
128833
def list_same(list_a, list_b):
    
    result = []
    for item in list_b:
        if item in list_a:
            result.append(item)
    return result
1227877
function isEqual(a, b)
{
	// objects are directly equal
	if(a === b){
		return true;
	}
	// recurse for each pair of array items
	else if( Array.isArray(a) && Array.isArray(b) && a.length === b.length ){
		return a.every( function (v,i) { return isEqual(a[i], b[i]); } );
	}
	// recurse for every key/val pair in objects
	else if( a instanceof Object && b instanceof Object
		&& isEqual(Object.keys(a).sort(), Object.keys(b).sort()) )
	{
		for(var k in a){
			if( !isEqual(a[k], b[k]) )
				{ return false; }
		}
		return true;
	}
	else {
		return false;
	}
}