Test if two values are equal to a given number of places.
    This is based on python's unittest so may be covered by Python's
    license.
968486
def almostequal(first, second, places=7, printit=True):
    
    if first == second:
        return True

    if round(abs(second - first), places) != 0:
        if printit:
            print(round(abs(second - first), places))
            print("notalmost: %s != %s to %i places" % (first, second, places))
        return False
    else:
        return True
384691
def _match(self, x, op, y):
        
        if (op not in self.condition_mapper):
            raise ValueError('Invalid where condition given')

        func = getattr(self, self.condition_mapper.get(op))
        return func(x, y)
222061
def _is_numeric(self, values):
        """"""
        if len(values) > 0:
            assert isinstance(values[0], (float, int)), \
                "values must be numbers to perform math operations. Got {}".format(
                    type(values[0]))
        return True
656694
def is_dicteq(dict1_, dict2_, almosteq_ok=True, verbose_err=True):
    
    import utool as ut
    assert len(dict1_) == len(dict2_), 'dicts are not of same length'
    try:
        for (key1, val1), (key2, val2) in zip(dict1_.items(), dict2_.items()):
            assert key1 == key2, 'key mismatch'
            assert type(val1) == type(val2), 'vals are not same type'
            if HAVE_NUMPY and np.iterable(val1):
                if almosteq_ok and ut.is_float(val1):
                    assert np.all(ut.almost_eq(val1, val2)), 'float vals are not within thresh'
                else:
                    assert all([np.all(x1 == x2) for (x1, x2) in zip(val1, val2)]), 'np vals are different'
            elif isinstance(val1, dict):
                is_dicteq(val1, val2, almosteq_ok=almosteq_ok, verbose_err=verbose_err)
            else:
                assert val1 == val2, 'vals are different'
    except AssertionError as ex:
        if verbose_err:
            ut.printex(ex)
        return False
    return True
1055144
def compare(self, first, second):
        
        if first.lower() == second.lower():
            return True
        else:
            return False
1130394
def __assert_equal(expected, returned, assert_print_result=True):
        '''
        
        '''
        result = "Pass"

        try:
            if assert_print_result:
                assert (expected == returned), "{0} is not equal to {1}".format(expected, returned)
            else:
                assert (expected == returned), "Result is not equal"
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
671263
def collapse_equal_values(values, counts):
    
    assert len(values) == len(counts)
    previousValue = values[0]
    previousCount = 0

    for value, count in zip(values, counts):
        if value != previousValue:
            yield (previousValue, previousCount)
            previousCount = 0
            previousValue = value
        previousCount += count

    yield (previousValue, previousCount)
149000
def equals(self, other):
        
        if isinstance(other, RangeIndex):
            ls = len(self)
            lo = len(other)
            return (ls == lo == 0 or
                    ls == lo == 1 and
                    self._start == other._start or
                    ls == lo and
                    self._start == other._start and
                    self._step == other._step)

        return super().equals(other)
940532
def multi_eq(*values)
    # If there is only 1 arg, it must be an array of at least 2 elements.
    values = values.first if values.first.is_a?(Array) && values.size == 1
    raise ArgumentError.new("Must be called with at least 2 parameters; was: #{values.inspect}") if values.size < 2
    values[1..-1].all? { |value| value == values.first }
  end
530933
function calculateStopPositions(stop1, stop2, count) {
    var good = function (values, unit) {
        return { values: values, unit: unit };
    };
    var bad = function (warning) {
        return { values: false, unit: '', warning: warning };
    };

    // Exit early if either value is calc()
    if (stop1 && isCalc(stop1.positionNode) || stop2 && isCalc(stop2.positionNode)) {
        return bad(errorStopPosition);
    }

    var startPos, endPos, baseUnit;
    var hasStartPos = true;
    var hasEndPos = true;

    var pos1 = stop1 && unitValue(stop1.positionNode);
    var pos2 = stop2 && unitValue(stop2.positionNode);
    if (!pos1) {
        hasStartPos = false;
        pos1 = { number: '0', unit: '%' };
    } else {
        count++;
    }
    if (!pos2) {
        hasEndPos = false;
        pos2 = { number: '100', unit: '%' };
    } else {
        count++;
    }

    // Check if missing stops can be calculated
    if (pos1.unit !== pos2.unit) {
        return bad(errorStopPosition);
    }
    startPos = +pos1.number || 0;
    endPos = +pos2.number || 0;
    baseUnit = pos1.unit;

    // Generate as many missing positions as required
    var positions = midRange(startPos, endPos, count);
    // Take off any known positions
    if (hasStartPos) {
        positions.shift();
    }
    if (hasEndPos) {
        positions.pop();
    }

    return good(positions, baseUnit);
}
925219
def _star_comparison(filter_value, tested_value):
    
    if not is_string(tested_value):
        # Unhandled value type...
        return False

    parts = filter_value.split("*")

    i = 0
    last_part = len(parts) - 1

    idx = 0
    for part in parts:
        # Find the part in the tested value
        idx = tested_value.find(part, idx)
        if idx == -1:
            # Part not found
            return False

        len_part = len(part)
        if i == 0 and len_part != 0 and idx != 0:
            # First part is not a star, but the tested value is not at
            # position 0 => Doesn't match
            return False

        if (
            i == last_part
            and len_part != 0
            and idx != len(tested_value) - len_part
        ):
            # Last tested part is not at the end of the sequence
            return False

        # Be sure to test the next part
        idx += len_part
        i += 1

    # Whole test passed
    return True
602628
def p_If(p):
    '''
    
    '''
    if len(p) == 2:
        p[0] = If(p[1], None, None)
    else:
        p[0] = If(p[1], p[5], p[4])
125381
def are_equal(value1, value2):
        
        if value1 == None or value2 == None:
            return True
        if value1 == None or value2 == None:
            return False
        return value1 == value2
1150462
def match(self, other):
        """"""

        if len(self) != len(other):
            raise ValueError()
        for s1, s2 in zip(self, other):
            i = s2.position - s1.position
            if i < 0:
                return False
            n = len(s1)
            while i+n > len(s2) and s1[n-1] == syntax.BLANK:
                n -= 1
            if s2.values[i:i+n] != s1.values[:n]:
                return False
        return True
824461
def almost_equals(self, other):
        
        for i in (0, 1, 2, 3, 4, 5):
            if abs(self[i] - other[i]) >= EPSILON:
                return False
        return True
1241497
def eq(self, o):
        

        if (self.is_integer
            and o.is_integer
            ):
            # Two integers
            if self.lower_bound == o.lower_bound:
                # They are equal
                return TrueResult()
            else:
                # They are not equal
                return FalseResult()

        else:
            if self.name == o.name:
                return TrueResult() # They are the same guy

            si_intersection = self.intersection(o)
            if si_intersection.is_empty:
                return FalseResult()

            else:
                return MaybeResult()
420461
public static boolean areEqual(Object value1, Object value2) {
		if (value1 == null && value2 == null)
			return true;
		if (value1 == null || value2 == null)
			return false;
		return value1.equals(value2);
	}