3
Êb_�  ã            
   @   s°   d Z ddlmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ eddd�Zd	d
„ Zde
ee eeef dœdd„Zde
ee ee ee eeee ee ef dœdd„ZdS )z* s3 support for remote file interactivity é    )ÚIOÚAnyÚOptionalÚTuple)Úurlparse)ÚFilePathOrBuffer)Úimport_optional_dependencyÚs3fsz0The s3fs package is required to handle s3 files.)Úextrac             C   s   t | dd�}|j|j S )z&Returns the url without the s3:// partF)Úallow_fragments)Ú	parse_urlÚnetlocÚpath)ÚurlÚresult© r   ú./tmp/pip-build-jkwsxyiy/pandas/pandas/io/s3.pyÚ_strip_schema   s    r   N)Úfilepath_or_bufferÚmodeÚreturnc             C   sv   ddl m} |d krd}tjdd�}y|jt| ƒ|ƒ}W n4 t|fk
rl   tjdd�}|jt| ƒ|ƒ}Y nX ||fS )Nr   )ÚNoCredentialsErrorÚrbF)ZanonT)Zbotocore.exceptionsr   r	   ZS3FileSystemÚopenr   ÚFileNotFoundError)r   r   r   ÚfsÚfiler   r   r   Úget_file_and_filesystem   s    r   )r   ÚencodingÚcompressionr   r   c             C   s   t | |d�\}}|d |dfS )N)r   T)r   )r   r   r   r   r   Z_fsr   r   r   Úget_filepath_or_buffer*   s    r    )N)NNN)Ú__doc__Útypingr   r   r   r   Úurllib.parser   r   Zpandas._typingr   Zpandas.compat._optionalr   r	   r   Ústrr   Úboolr    r   r   r   r   Ú<module>   s   

  