コード例 #1
0
 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
コード例 #2
0
 def __init__(self, *args, **kw):
     self.bytesout = 0
     self.bytesmax = 0
     self.morecalls = 0
     LinesProducer.__init__(self, *args, **kw)
コード例 #3
0
def lineproducer(generator):
    if debug:
        return DebuggingLinesProducer(generator)
    return LinesProducer(generator)