(iterator, r)
Stream decodes a iterator.
Stream decodes a iterator.
Stream decodes a iterator .
def stream_decode_response_unicode(iterator, r):
    """Stream decodes a iterator."""

    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(b'', 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 ( b'' , final = True ) if rv : yield rv