def __eq__(self, other): return isinstance(other, Categorize) and numeq( self.entries, other.entries ) and self.quantity == other.quantity and self.bins == other.bins
def __eq__(self, other): return isinstance(other, UntypedLabel) and numeq( self.entries, other.entries) and self.pairs == other.pairs
def __eq__(self, other): return isinstance( other, CentrallyBin) and self.quantity == other.quantity and numeq( self.entries, other.entries ) and self.bins == other.bins and self.nanflow == other.nanflow
def __eq__(self, other): return isinstance(other, Stack) and numeq(self.entries, other.entries) and self.quantity == other.quantity and \ all(numeq(c1, c2) and v1 == v2 for (c1, v1), (c2, v2) in zip(self.bins, other.bins)) and \ self.nanflow == other.nanflow
def __eq__(self, other): return isinstance(other, Branch) and numeq( self.entries, other.entries) and self.values == other.values
def __eq__(self, other): if len(self.values) != len(other.values): return False if self.range != other.range: return False if self.range == "N": one = sorted(x for x in self.values.items() if x[0] != "nan") + [("nan", self.values.get("nan"))] two = sorted(x for x in other.values.items() if x[0] != "nan") + [("nan", other.values.get("nan"))] elif self.range[0] == "N": class Sorter(object): def __init__(self, x): self.x = x def __lt__(self, other): for xi, yi in zip(self.x, other.x): if isinstance(xi, str) and isinstance(yi, float): return False elif isinstance(xi, float) and isinstance(yi, str): return True elif xi < yi: return True elif xi > yi: return False return False one = sorted((x for x in self.values.items()), key=lambda y: tuple(Sorter(z) for z in y)) two = sorted((x for x in other.values.items()), key=lambda y: tuple(Sorter(z) for z in y)) else: one = sorted(x for x in self.values.items()) two = sorted(x for x in other.values.items()) for (v1, w1), (v2, w2) in zip(one, two): if isinstance(v1, basestring) and isinstance(v2, basestring): if v1 != v2: return False elif isinstance(v1, numbers.Real) and isinstance(v2, numbers.Real): if not numeq(v1, v2): return False elif isinstance(v1, tuple) and isinstance(v2, tuple) and len(v1) == len(v2): for v1i, v2i in zip(v1, v2): if isinstance(v1i, numbers.Real) and isinstance(v2i, numbers.Real): if not numeq(v1i, v2i): return False elif isinstance(v1i, basestring) and isinstance(v2i, basestring): if v1i != v2i: return False else: return False else: return False if v1 == "nan" and v2 == "nan" and w1 is None and w2 is None: pass elif isinstance(w1, numbers.Real) and isinstance(w2, numbers.Real): if not numeq(w1, w2): return False else: return False return isinstance(other, Bag) and self.quantity == other.quantity and numeq(self.entries, other.entries)
def __eq__(self, other): return isinstance(other, Fraction) and numeq(self.entries, other.entries) and \ self.quantity == other.quantity and self.numerator == other.numerator and \ self.denominator == other.denominator
def __eq__(self, other): return isinstance( other, Maximize) and self.quantity == other.quantity and numeq( self.entries, other.entries) and numeq(self.max, other.max)
def __eq__(self, other): return isinstance(other, Sum) and self.quantity == other.quantity and numeq( self.entries, other.entries) and numeq(self.sum, other.sum)
def __eq__(self, other): return isinstance( other, Average) and self.quantity == other.quantity and numeq( self.entries, other.entries) and numeq(self.mean, other.mean)
def __eq__(self, other): return isinstance(other, Count) and numeq(self.entries, other.entries) and self.transform == other.transform
def __eq__(self, other): return isinstance(other, SparselyBin) and numeq(self.binWidth, other.binWidth) and \ self.quantity == other.quantity and numeq(self.entries, other.entries) and self.bins == other.bins and \ self.nanflow == other.nanflow and numeq(self.origin, other.origin)