#NEWLINE# def stream_decode_gzip( iterator ) : #NEWLINE# #INDENT# 'Stream decodes a gzip-encoded iterator' #NEWLINE# try : #NEWLINE# #INDENT# dec = zlib . decompressobj ( ( 16 + zlib . MAX_WBITS ) ) #NEWLINE# for chunk in iterator : #NEWLINE# #INDENT# rv = dec . decompress ( chunk ) #NEWLINE# if rv : #NEWLINE# #INDENT# ( yield rv ) #NEWLINE# #UNINDENT# #UNINDENT# buf = dec . decompress ( '' ) #NEWLINE# rv = ( buf + dec . flush ( ) ) #NEWLINE# if rv : #NEWLINE# #INDENT# ( yield rv ) #NEWLINE# #UNINDENT# #UNINDENT# except zlib . error : #NEWLINE# #INDENT# pass