B [] @sdZddlmZmZmZmZddlmZddl m Z ddl m Z e dddZ d d Zde eeeeefd d dZde eeeeeeeeeeeeefdddZd S)z* s3 support for remote file interactivity )IOAnyOptionalTuple)urlparse)import_optional_dependency)FilePathOrBuffers3fsz0The s3fs package is required to handle s3 files.)extracCst|dd}|j|jS)z&Returns the url without the s3:// partF)allow_fragments) parse_urlnetlocpath)urlresultr0/tmp/pip-install-svzetoqp/pandas/pandas/io/s3.py _strip_schemas rN)filepath_or_buffermodereturnc Csvddlm}|dkrd}tjdd}y|t||}Wn4t|fk rltjdd}|t||}YnX||fS)Nr)NoCredentialsErrorrbF)ZanonT)Zbotocore.exceptionsrr Z S3FileSystemopenrFileNotFoundError)rrrfsfilerrrget_file_and_filesystems   r)rencoding compressionrrcCst||d\}}|d|dfS)N)rT)r)rrrrrZ_fsrrrget_filepath_or_buffer+sr )N)NNN)__doc__typingrrrr urllib.parserr Zpandas.compat._optionalrZpandas._typingrr rstrrboolr rrrrs