python Programming Glossary: self.buffer
Python: Creating a streaming gzip'd file-like? http://stackoverflow.com/questions/2192529/python-creating-a-streaming-gzipd-file-like def __init__ self input filename None self.input input self.buffer '' self.zipper GzipFile filename mode 'wb' fileobj self def.. 'wb' fileobj self def read self size 1 if size 0 or len self.buffer size for s in self.input self.zipper.write s if size 0 and.. s in self.input self.zipper.write s if size 0 and len self.buffer size self.zipper.flush break else self.zipper.close if size..
How to replicate tee behavior in python when using subprocess? http://stackoverflow.com/questions/2996887/how-to-replicate-tee-behavior-in-python-when-using-subprocess Thread def __init__ self buffer Thread.__init__ self self.buffer buffer def run self while 1 line self.buffer.readline print.. self self.buffer buffer def run self while 1 line self.buffer.readline print line end sys.stdout.flush if line '' break..
How to detect motion between two PIL images? (wxPython webcam integration example included) http://stackoverflow.com/questions/5524179/how-to-detect-motion-between-two-pil-images-wxpython-webcam-integration-exampl height self.control control self.isRunning True self.buffer wx.NullBitmap threading.Thread.__init__ self def getResolution.. colour self.backColour colour def getBuffer self return self.buffer def stop self self.isRunning False def run self while self.isRunning.. 'RGB' width height buffer 'raw' 'BGR' 0 1 buff im.tostring self.buffer wx.BitmapFromBuffer width height buff x y 0 0 try width height..
Multiple writes get handled as single one http://stackoverflow.com/questions/9959616/multiple-writes-get-handled-as-single-one byte import socket class Client object def __init__ self self.buffer '' self.sock None def connect self address self.buffer '' self.sock.. self.buffer '' self.sock None def connect self address self.buffer '' self.sock socket.socket self.sock.connect address def get_msg.. leaving the remainder in the buffer. ''' while not ' n' in self.buffer data self.sock.recv 4096 if not data return '' self.buffer..
|