HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //lib/python3.9/site-packages/S3/__pycache__/S3Uri.cpython-39.pyc
a

�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�ede���ede���e�ed�Zedee��ede�edej�ede���e�ed�Zedee��ede�edej�ede���e�ed�Zedee��ede�edej�ede���e�ed�Zedee��ede�edej�ede���e�dS)�)�absolute_import�print_functionN�)�	unicodise�deunicodise�check_bucket_name_dns_support)�Config)�rc@sDeZdZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�S3UriNc	Cs�|jsbg|_tjtj}|D]D}t||�t|�ur6qt|||�r|||kr|j�||�q|jD]:}zt�	|�}|�
|�|WSty�YqhYqh0qhtd|��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.9/site-packages/S3/S3Uri.pyrs 



z
S3Uri.__new__cCstr|��St|���SdS�N)�PY3�urir�rrrr�__str__0sz
S3Uri.__str__cCs|��Sr)r r!rrr�__unicode__6szS3Uri.__unicode__cCstd|jj|��f�S)Nz<%s: %s>)�repr�	__class__rr#r!rrr�__repr__9szS3Uri.__repr__cCstd��dS)Nz6This S3 URI does not have Anonymous URL representation)rr!rrr�
public_url<szS3Uri.public_urlcCs|���d�dS)N�/���)r#�splitr!rrr�basename?szS3Uri.basename)r�
__module__�__qualname__rrrr"r#r&r'r+rrrrr
sr
c@s�eZdZdZe�dejejB�Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zeddd��Zedd��ZdS)�S3UriS3Zs3z^s3:///*([^/]*)/?(.*)cCs<|j�|�}|std|��|��}|d|_|d|_dS)Nz%s: not a S3 URIrr)�_re�matchr�groups�_bucket�_object�rrr0r1rrrrEs
zS3UriS3.__init__cCs|jSr)r2r!rrr�bucketMszS3UriS3.bucketcCs|jSr)r3r!rrrrPszS3UriS3.objectcCs
t|j�Sr)�boolr2r!rrr�
has_bucketSszS3UriS3.has_bucketcCs
t|j�Sr)r6r3r!rrr�
has_objectVszS3UriS3.has_objectcCsd�d|j|jg�S)Nr(zs3:/)�joinr2r3r!rrrr YszS3UriS3.uricCstt��j|j�Sr)rrZhost_bucketr2r!rrr�is_dns_compatible\szS3UriS3.is_dns_compatiblecCsRd}t��jrd}|��r4d||jt��j|jfSd|t��j|j|jfSdS)N�http�httpsz
%s://%s.%s/%sz
%s://%s/%s/%s)rZpublic_url_use_httpsr:r2Z	host_baser3)rZpublic_url_protocolrrrr'_s
zS3UriS3.public_urlcCs|��rd|jSdSdS)Nz%s.s3.amazonaws.comzs3.amazonaws.com)r:r2r!rrr�	host_namehs
zS3UriS3.host_name�cCsd||fS)Nz
s3://%s/%sr�r5rrrr�compose_urinszS3UriS3.compose_uricCs�t�d|tjtjB�}|��dd�\}}|��}t�d|tjtjB�}|sXtd|��|��d}|s�d|vrz|}d}q�|�dd�\}}n
|�d�}t	d	||d
��S)Nz(https?://)?([^/]+)/?(.*)rzM(.*\.)?s3(?:\-[^\.]*)?(?:\.dualstack)?(?:\.[^\.]*)?\.amazonaws\.com(?:\.cn)?$zUnable to parse URL: %srr(r>�.zs3://%(bucket)s/%(object)sr?)
�rer0�
IGNORECASE�UNICODEr1�lowerrr*�rstripr
)Zhttp_url�m�hostnamerr5rrr�httpurl_to_s3urirs*�
��zS3UriS3.httpurl_to_s3uriN)r>)rr,r-rrB�compilerCrDr/rr5rr7r8r r:r'r=�staticmethodr@rIrrrrr.Bs	r.c@sDeZdZdZe�dejejB�Zdd�Z	dd�Z
dd�Zd	d
�ZdS)�	S3UriS3FSZs3fsz^s3fs:///*([^/]*)/?(.*)cCsB|j�|�}|std|��|��}|d|_|d�d�|_dS)Nz%s: not a S3fs URIrrr()r/r0rr1�_fsnamer*�_pathr4rrrr�s
zS3UriS3FS.__init__cCs|jSr)rMr!rrr�fsname�szS3UriS3FS.fsnamecCsd�|j�S)Nr(�r9rNr!rrr�path�szS3UriS3FS.pathcCsd�d|j|��g�S)Nr(zs3fs:/)r9rMrQr!rrrr �sz
S3UriS3FS.uriN)
rr,r-rrBrJrCrDr/rrOrQr rrrrrL�srLc@sNeZdZdZe�dej�Zdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dS)�	S3UriFile�filez^(\w+://)?(.*)cCs`|j�|�}|��}|ddvr,td|��|ddurL|d�tj�|_n|d�d�|_dS)Nr)Nzfile://z%s: not a file:// URIrr()r/r0r1rr*�os�seprNr4rrrr�szS3UriFile.__init__cCstj�|j�Sr)rTrUr9rNr!rrrrQ�szS3UriFile.pathcCsd�dg|j�S)Nr(zfile:/rPr!rrrr �sz
S3UriFile.uricCstj�t|����Sr)rTrQ�isdirrr!rrrrV�szS3UriFile.isdircCsttj�t|�����Sr)rrTrQ�dirnamerr!rrrrW�szS3UriFile.dirnamecCsttj�t|�����Sr)rrTrQr+rr!rrrr+�szS3UriFile.basenameN)rr,r-rrBrJrDr/rrQr rVrWr+rrrrrR�s
rRc@sDeZdZdZe�dejejB�Zdd�Z	dd�Z
dd�Zd	d
�ZdS)�S3UriCloudFront�cfz^cf://([^/]*)/*(.*)cCsL|j�|�}|std|��|��}|d|_|ddkrB|dpDd|_dS)Nz%s: not a CloudFront URIrrr()r/r0rr1�_dist_id�_request_idr4rrrr�s
zS3UriCloudFront.__init__cCs|jSr)rZr!rrr�dist_id�szS3UriCloudFront.dist_idcCs|jSr)r[r!rrr�
request_id�szS3UriCloudFront.request_idcCs(d|��}|��r$|d|��7}|S)Nzcf://r()r\r])rr rrrr �szS3UriCloudFront.uriN)
rr,r-rrBrJrCrDr/rr\r]r rrrrrX�srX�__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 =)Z
__future__rrrTrBrZUtilsrrrr>r�version_inforrr
r.rLrRrXrr �printrr5rQr\rrrr�<module>
sV
)R