HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/thread-self/root/lib/python3.6/site-packages/S3/__pycache__/S3Uri.cpython-36.pyc
3

�9pe��@s�ddlmZmZddlZddlZddlZddlmZmZm	Z	ddl
mZejdkZ
Gdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�Zedk�r�ed�Zedee��ede�edej�edej��edej��e�ed�Zedee��ede�edej�edej��e�ed�Zedee��ede�edej�edej��e�ed�Zedee��ede�edej�edej��e�ed�Zedee��ede�edej�edej��e�dS)�)�absolute_import�print_functionN�)�	unicodise�deunicodise�check_bucket_name_dns_support)�Config�c@sDeZdZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�S3UriNcCs�|jsfg|_tjtj}xL|D]D}t||�t|�k	r8qt|||�r|||kr|jj||�qWx>|jD]4}ytj	|�}|j
|�|Stk
r�wnYqnXqnWtd|��dS)Nz%s: not a recognized URI)�_subclasses�sys�modules�__name__�__dict__�type�
issubclass�append�object�__new__�__init__�
ValueError)�self�string�dictZ	something�subclass�instance�r�/usr/lib/python3.6/S3Uri.pyrs 


z
S3Uri.__new__cCstr|j�St|j��SdS)N)�PY3�urir)rrrr�__str__0sz
S3Uri.__str__cCs|j�S)N)r)rrrr�__unicode__6szS3Uri.__unicode__cCstd|jj|j�f�S)Nz<%s: %s>)�repr�	__class__rr!)rrrr�__repr__9szS3Uri.__repr__cCstd��dS)Nz6This S3 URI does not have Anonymous URL representation)r)rrrr�
public_url<szS3Uri.public_urlcCs|j�jd�dS)N�/r���)r!�split)rrrr�basename?szS3Uri.basename)r�
__module__�__qualname__rrrr r!r$r%r)rrrrr
sr
c@s�eZdZdZejdejejB�Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zeddd��Zedd��ZdS)�S3UriS3Zs3z^s3:///*([^/]*)/?(.*)cCs<|jj|�}|std|��|j�}|d|_|d|_dS)Nz%s: not a S3 URIrr)�_re�matchr�groups�_bucket�_object)rrr.r/rrrrEs
zS3UriS3.__init__cCs|jS)N)r0)rrrr�bucketMszS3UriS3.bucketcCs|jS)N)r1)rrrrrPszS3UriS3.objectcCs
t|j�S)N)�boolr0)rrrr�
has_bucketSszS3UriS3.has_bucketcCs
t|j�S)N)r3r1)rrrr�
has_objectVszS3UriS3.has_objectcCsdjd|j|jg�S)Nr&zs3:/)�joinr0r1)rrrrrYszS3UriS3.uricCsttj�j|j�S)N)rrZhost_bucketr0)rrrr�is_dns_compatible\szS3UriS3.is_dns_compatiblecCsRd}tj�jrd}|j�r4d||jtj�j|jfSd|tj�j|j|jfSdS)NZhttpZhttpsz
%s://%s.%s/%sz
%s://%s/%s/%s)rZpublic_url_use_httpsr7r0Z	host_baser1)rZpublic_url_protocolrrrr%_s
zS3UriS3.public_urlcCs|j�rd|jSdSdS)Nz%s.s3.amazonaws.comzs3.amazonaws.com)r7r0)rrrr�	host_namehs
zS3UriS3.host_name�cCsd||fS)Nz
s3://%s/%sr)r2rrrr�compose_urinszS3UriS3.compose_uricCs�tjd|tjtjB�}|j�dd�\}}|j�}tjd|tjtjB�}|sXtd|��|j�d}|s�d|krz|}d}q�|jdd�\}}n
|jd�}t	d	||d
��S)Nz(https?://)?([^/]+)/?(.*)rzM(.*\.)?s3(?:\-[^\.]*)?(?:\.dualstack)?(?:\.[^\.]*)?\.amazonaws\.com(?:\.cn)?$zUnable to parse URL: %srr&r9�.zs3://%(bucket)s/%(object)s)r2r)
�rer.�
IGNORECASE�UNICODEr/�lowerrr(�rstripr
)Zhttp_url�mZhostnamerr2rrr�httpurl_to_s3urirs$
zS3UriS3.httpurl_to_s3uriN)r9)rr*r+rr<�compiler=r>r-rr2rr4r5rr7r%r8�staticmethodr:rBrrrrr,Bs	r,c@sDeZdZdZejdejejB�Zdd�Z	dd�Z
dd�Zd	d
�ZdS)�	S3UriS3FSZs3fsz^s3fs:///*([^/]*)/?(.*)cCsB|jj|�}|std|��|j�}|d|_|djd�|_dS)Nz%s: not a S3fs URIrrr&)r-r.rr/�_fsnamer(�_path)rrr.r/rrrr�s
zS3UriS3FS.__init__cCs|jS)N)rF)rrrr�fsname�szS3UriS3FS.fsnamecCsdj|j�S)Nr&)r6rG)rrrr�path�szS3UriS3FS.pathcCsdjd|j|j�g�S)Nr&zs3fs:/)r6rFrI)rrrrr�sz
S3UriS3FS.uriN)
rr*r+rr<rCr=r>r-rrHrIrrrrrrE�srEc@sNeZdZdZejdej�Zdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dS)�	S3UriFile�filez^(\w+://)?(.*)cCs`|jj|�}|j�}|ddkr,td|��|ddkrL|djtj�|_n|djd�|_dS)Nr�file://z%s: not a file:// URIrr&)NrL)r-r.r/rr(�os�seprG)rrr.r/rrrr�szS3UriFile.__init__cCstjj|j�S)N)rMrNr6rG)rrrrrI�szS3UriFile.pathcCsdjdg|j�S)Nr&zfile:/)r6rG)rrrrr�sz
S3UriFile.uricCstjjt|j���S)N)rMrI�isdirr)rrrrrO�szS3UriFile.isdircCsttjjt|j����S)N)rrMrI�dirnamer)rrrrrP�szS3UriFile.dirnamecCsttjjt|j����S)N)rrMrIr)r)rrrrr)�szS3UriFile.basenameN)rr*r+rr<rCr>r-rrIrrOrPr)rrrrrJ�s
rJc@sDeZdZdZejdejejB�Zdd�Z	dd�Z
dd�Zd	d
�ZdS)�S3UriCloudFrontZcfz^cf://([^/]*)/*(.*)cCsL|jj|�}|std|��|j�}|d|_|ddkrB|dpDd|_dS)Nz%s: not a CloudFront URIrrr&)r-r.rr/�_dist_id�_request_id)rrr.r/rrrr�s
zS3UriCloudFront.__init__cCs|jS)N)rR)rrrr�dist_id�szS3UriCloudFront.dist_idcCs|jS)N)rS)rrrr�
request_id�szS3UriCloudFront.request_idcCs(d|j�}|j�r$|d|j�7}|S)Nzcf://r&)rTrU)rrrrrr�szS3UriCloudFront.uriN)
rr*r+rr<rCr=r>r-rrTrUrrrrrrQ�srQ�__main__zs3://bucket/objectz	type()  =z	uri     =z	uri.type=z	bucket  =z	object  =zs3://bucketz*s3fs://filesystem1/path/to/remote/file.txtz	path    =z/path/to/local/file.txtzcf://1234567890ABCD/z	dist_id =)r	r)Z
__future__rrrMr<rZUtilsrrrr9r�version_inforrr
r,rErJrQrr�printrr2rIrTrrrr�<module>
sV
)R