def flush(self):
        n = self.accumulator
        self.accumulator = 0

        stream = self.stream
        stream.append(n)
        self.sum += n

        streamlen = len(stream)

        if streamlen > self.period:
            self.sum -= stream.popleft()
            streamlen -= 1

        if streamlen == 0:
            self.last_average = 0
        else:
            self.last_average = self.sum / streamlen
Static factory method. Returns the Entity representation of the
dataset/ETHPy150Open flaviogrossi/sockjs-cyclone/sockjs/cyclone/stats.py/MovingAverage.flush--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/datastore.py/Entity.FromPb