def _make_chunk_iter(stream, limit, buffer_size):
 if isinstance(stream, (bytes, bytearray, text_type)):
  raise TypeError('Passed a string or byte object instead of true iterator or stream.')
 if (not hasattr(stream, 'read')):
  for item in stream:
   if item:
    (yield item)
  return
 if ((not isinstance(stream, LimitedStream)) and (limit is not None)):
  stream = LimitedStream(stream, limit)
 _read = stream.read
 while 1:
  item = _read(buffer_size)
  if (not item):
   break
  (yield item)

def _make_chunk_iter ( stream , limit , buffer_size ) : if isinstance ( stream , ( bytes , bytearray , text_type ) ) : raise TypeError ( 'Passed a string or byte object instead of true iterator or stream.' ) if ( not hasattr ( stream , 'read' ) ) : for item in stream : if item : ( yield item ) return if ( ( not isinstance ( stream , LimitedStream ) ) and ( limit is not None ) ) : stream = LimitedStream ( stream , limit ) _read = stream . read while 1 : item = _read ( buffer_size ) if ( not item ) : break ( yield item )
helper for the line and chunk iter functions .