def more(self, *args, **kw): data = LinesProducer.more(self, *args, **kw) self.morecalls += 1 self.bytesout += len(data) self.bytesmax = max(self.bytesmax, len(data)) if not data: message = "more() invoked %d times, %db max, %db total" print message % (self.morecalls, self.bytesmax, self.bytesout) return data
def __init__(self, *args, **kw): self.bytesout = 0 self.bytesmax = 0 self.morecalls = 0 LinesProducer.__init__(self, *args, **kw)
def lineproducer(generator): if debug: return DebuggingLinesProducer(generator) return LinesProducer(generator)