def __init__( self, variance: VarianceTracker = None, floats: FloatTracker = None, ints: IntTracker = None, theta_sketch: ThetaSketch = None, histogram: datasketches.kll_floats_sketch = None, frequent_numbers: dsketch.FrequentNumbersSketch = None, ): # Our own trackers if variance is None: variance = VarianceTracker() if floats is None: floats = FloatTracker() if ints is None: ints = IntTracker() if theta_sketch is None: theta_sketch = ThetaSketch() if histogram is None: histogram = datasketches.kll_floats_sketch(DEFAULT_HIST_K) if frequent_numbers is None: frequent_numbers = dsketch.FrequentNumbersSketch() self.variance = variance self.floats = floats self.ints = ints self.theta_sketch = theta_sketch self.histogram = histogram self.frequent_numbers = frequent_numbers
def test_empty_sketch_returns_empty(): assert dsketch.FrequentNumbersSketch(32).is_empty()
def number_sketch(): items = dsketch.FrequentNumbersSketch(32) for val in NUMBER_SKETCH_VALS: assert isinstance(val, (float, int)) items.update(val) return items