def stream_decode_response_unicode(iterator, r):
 if (r.encoding is None):
  for item in iterator:
   (yield item)
  return
 decoder = codecs.getincrementaldecoder(r.encoding)(errors='replace')
 for chunk in iterator:
  rv = decoder.decode(chunk)
  if rv:
   (yield rv)
 rv = decoder.decode('', final=True)
 if rv:
  (yield rv)

def stream_decode_response_unicode ( iterator , r ) : if ( r . encoding is None ) : for item in iterator : ( yield item ) return decoder = codecs . getincrementaldecoder ( r . encoding ) ( errors = 'replace' ) for chunk in iterator : rv = decoder . decode ( chunk ) if rv : ( yield rv ) rv = decoder . decode ( '' , final = True ) if rv : ( yield rv )
stream decodes a iterator .