def get_filepath_or_buffer(filepath_or_buffer, encoding=None, compression=None):
 if _is_url(filepath_or_buffer):
  url = str(filepath_or_buffer)
  req = _urlopen(url)
  content_encoding = req.headers.get('Content-Encoding', None)
  if (content_encoding == 'gzip'):
   compression = 'gzip'
  reader = BytesIO(req.read())
  return (reader, encoding, compression)
 if _is_s3_url(filepath_or_buffer):
  from pandas.io import s3
  return s3.get_filepath_or_buffer(filepath_or_buffer, encoding=encoding, compression=compression)
 filepath_or_buffer = _stringify_path(filepath_or_buffer)
 return (_expand_user(filepath_or_buffer), None, compression)

def get_filepath_or_buffer ( filepath_or_buffer , encoding = None , compression = None ) : if _is_url ( filepath_or_buffer ) : url = str ( filepath_or_buffer ) req = _urlopen ( url ) content_encoding = req . headers . get ( 'Content-Encoding' , None ) if ( content_encoding == 'gzip' ) : compression = 'gzip' reader = BytesIO ( req . read ( ) ) return ( reader , encoding , compression ) if _is_s3_url ( filepath_or_buffer ) : from pandas . io import s3 return s3 . get_filepath_or_buffer ( filepath_or_buffer , encoding = encoding , compression = compression ) filepath_or_buffer = _stringify_path ( filepath_or_buffer ) return ( _expand_user ( filepath_or_buffer ) , None , compression )
if the filepath_or_buffer is a url .