def _read(filepath_or_buffer, kwds):
 encoding = kwds.get('encoding', None)
 if (encoding is not None):
  encoding = re.sub('_', '-', encoding).lower()
  kwds['encoding'] = encoding
 compression = kwds.get('compression')
 compression = _infer_compression(filepath_or_buffer, compression)
 (filepath_or_buffer, _, compression) = get_filepath_or_buffer(filepath_or_buffer, encoding, compression)
 kwds['compression'] = compression
 if (kwds.get('date_parser', None) is not None):
  if isinstance(kwds['parse_dates'], bool):
   kwds['parse_dates'] = True
 iterator = kwds.get('iterator', False)
 chunksize = kwds.get('chunksize', None)
 nrows = _validate_nrows(kwds.pop('nrows', None))
 parser = TextFileReader(filepath_or_buffer, **kwds)
 if ((nrows is not None) and (chunksize is not None)):
  raise NotImplementedError("'nrows' and 'chunksize' cannot be used together yet.")
 elif (nrows is not None):
  try:
   data = parser.read(nrows)
  finally:
   parser.close()
  return data
 elif (chunksize or iterator):
  return parser
 try:
  data = parser.read()
 finally:
  parser.close()
 return data

def _read ( filepath_or_buffer , kwds ) : encoding = kwds . get ( 'encoding' , None ) if ( encoding is not None ) : encoding = re . sub ( '_' , '-' , encoding ) . lower ( ) kwds [ 'encoding' ] = encoding compression = kwds . get ( 'compression' ) compression = _infer_compression ( filepath_or_buffer , compression ) ( filepath_or_buffer , _ , compression ) = get_filepath_or_buffer ( filepath_or_buffer , encoding , compression ) kwds [ 'compression' ] = compression if ( kwds . get ( 'date_parser' , None ) is not None ) : if isinstance ( kwds [ 'parse_dates' ] , bool ) : kwds [ 'parse_dates' ] = True iterator = kwds . get ( 'iterator' , False ) chunksize = kwds . get ( 'chunksize' , None ) nrows = _validate_nrows ( kwds . pop ( 'nrows' , None ) ) parser = TextFileReader ( filepath_or_buffer , ** kwds ) if ( ( nrows is not None ) and ( chunksize is not None ) ) : raise NotImplementedError ( "'nrows' and 'chunksize' cannot be used together yet." ) elif ( nrows is not None ) : try : data = parser . read ( nrows ) finally : parser . close ( ) return data elif ( chunksize or iterator ) : return parser try : data = parser . read ( ) finally : parser . close ( ) return data
returns an iterator over the lines in the file at the given path .