def bunzip2_stream(fileobj, bufsize=1024):
 if (bz2 is None):
  raise Exception('bz2 module was not successfully imported (likely not installed).')
 d = bz2.BZ2Decompressor()
 while True:
  chunk = fileobj.read(bufsize)
  if (not chunk):
   return
  part = d.decompress(chunk)
  if part:
   (yield part)

def bunzip2_stream ( fileobj , bufsize = 1024 ) : if ( bz2 is None ) : raise Exception ( 'bz2 module was not successfully imported (likely not installed).' ) d = bz2 . BZ2Decompressor ( ) while True : chunk = fileobj . read ( bufsize ) if ( not chunk ) : return part = d . decompress ( chunk ) if part : ( yield part )
decompress gzipped data on the fly .