https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/s3/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/s3/__pycache__/multipart.cpython-310.pyc
o

ckF[/�@sjddlmZddlmZddlmZddlZGdd�de�ZGdd�de�Z	d
d	d
�Z
Gdd�de�ZdS)�)�user)�key)�handlerNc@�2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)�CompleteMultiPartUploada�
    Represents a completed MultiPart Upload.  Contains the
    following useful attributes:

     * location - The URI of the completed upload
     * bucket_name - The name of the bucket in which the upload
                     is contained
     * key_name - The name of the new, completed key
     * etag - The MD5 hash of the completed, combined upload
     * version_id - The version_id of the completed upload
     * encrypted - The value of the encryption header
    NcCs.||_d|_d|_d|_d|_d|_d|_dS�N)�bucket�location�bucket_name�key_name�etag�
version_id�	encrypted��selfr�r�3/usr/lib/python3/dist-packages/boto/s3/multipart.py�__init__-s
z CompleteMultiPartUpload.__init__cCsd|j|jfS)Nz <CompleteMultiPartUpload: %s.%s>)r
r�rrrr�__repr__6s�z CompleteMultiPartUpload.__repr__cC�dSrr�r�name�attrs�
connectionrrr�startElement:�z$CompleteMultiPartUpload.startElementcCsX|dkr	||_dS|dkr||_dS|dkr||_dS|dkr$||_dSt|||�dS)N�Location�Bucket�Key�ETag)r	r
rr�setattr�rr�valuerrrr�
endElement=s



z"CompleteMultiPartUpload.endElementr��__name__�
__module__�__qualname__�__doc__rrrr$rrrrrs

	rc@r)�Parta
    Represents a single part in a MultiPart upload.
    Attributes include:

     * part_number - The integer part number
     * last_modified - The last modified date of this part
     * etag - The MD5 hash of this part
     * size - The size, in bytes, of this part
    NcCs"||_d|_d|_d|_d|_dSr)r�part_number�
last_modifiedr�sizerrrrrUs

z
Part.__init__cCst|jt�rd|jSddS)Nz	<Part %d>z	<Part %s>)�
isinstancer+�intrrrrr\s
z
Part.__repr__cCrrrrrrrrbrzPart.startElementcCs`|dkrt|�|_dS|dkr||_dS|dkr||_dS|dkr(t|�|_dSt|||�dS)N�
PartNumber�LastModifiedr �Size)r/r+r,rr-r!r"rrrr$es

zPart.endElementrr%rrrrr*Js

r*ccsB�d}d}|r|�d|�}|D]}|Vq|j}|j}|sdSdS)zG
    A generator function for listing parts of a multipart upload.
    TN)�
get_all_parts�next_part_number_marker�is_truncated)�mpupload�part_number_marker�more_results�part�partsrrr�part_listerrs��r;c@s|eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z			ddd�Z
		ddd�Z		ddd�Zdd�Z
dd�ZdS)�MultiPartUploadz2
    Represents a MultiPart Upload operation.
    NcCsR||_d|_d|_t|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_dS)NF)
rr
r�id�	initiator�owner�
storage_class�	initiatedr7r4�	max_partsr5�_partsrrrrr�s
zMultiPartUpload.__init__cCs
d|jS)Nz<MultiPartUpload %s>)rrrrrr�s
zMultiPartUpload.__repr__cCst|�Sr)r;rrrr�__iter__�szMultiPartUpload.__iter__cCsFd}|D]}|d7}|d|j7}|d|j7}|d7}q|d7}|S)Nz<CompleteMultipartUpload>
z	  <Part>
z     <PartNumber>%d</PartNumber>
z    <ETag>%s</ETag>
z
  </Part>
z</CompleteMultipartUpload>)r+r)r�sr9rrr�to_xml�s
zMultiPartUpload.to_xmlcCsZ|dkr
t�|�|_|jS|dkrt�|�|_|jS|dkr+t|j�}|j�|�|SdS)N�	Initiator�Ownerr*)r�Userr>r?r*rrC�append)rrrrr9rrrr�s
zMultiPartUpload.startElementcCs�|dkr	||_dS|dkr||_dS|dkr||_dS|dkr$||_dS|dkr-||_dS|dkr6||_dS|dkrAt|�|_dS|dkrS|d	krNd
|_dSd|_dS|dkr\||_	dSt
|||�dS)
Nrr�UploadId�StorageClass�PartNumberMarker�NextPartNumberMarker�MaxParts�IsTruncated�trueTF�	Initiated)r
rr=r@r7r4r/rBr5rAr!r"rrrr$�s*








zMultiPartUpload.endElementcCs�g|_d|j}|r|d|7}|r|d|7}|r |d|7}|jjjd|jj|j|d�}|��}|jdkrGt	�
||�}tj�
||�|jSdS)	a@
        Return the uploaded parts of this MultiPart Upload.  This is
        a lower-level method that requires you to manually page through
        results.  To simplify this process, you can just use the
        object itself as an iterator and it will automatically handle
        all of the paging with S3.
        zuploadId=%sz
&max-parts=%dz&part-number-marker=%sz&encoding-type=%s�GET)�
query_args��N)rCr=rr�make_requestrr�read�statusr�
XmlHandler�xml�sax�parseString)rrBr7�
encoding_typerT�response�body�hrrrr3�s$	
�
�zMultiPartUpload.get_all_partsT�
c	CsL|dkrtd��d|j|f}	|j�|j�}
|
j||||||d|	|d�	|
S)a_
        Upload another part of this MultiPart Upload.

        .. note::

            After you initiate multipart upload and upload one or more parts,
            you must either complete or abort multipart upload in order to stop
            getting charged for storage of the uploaded parts. Only after you
            either complete or abort multipart upload, Amazon S3 frees up the
            parts storage and stops charging you for the parts storage.

        :type fp: file
        :param fp: The file object you want to upload.

        :type part_num: int
        :param part_num: The number of this part.

        The other parameters are exactly as defined for the
        :class:`boto.s3.key.Key` set_contents_from_file method.

        :rtype: :class:`boto.s3.key.Key` or subclass
        :returns: The uploaded part containing the etag.
        ��&Part numbers must be greater than zero�uploadId=%s&partNumber=%dF)�headers�replace�cb�num_cb�md5�reduced_redundancyrTr-)�
ValueErrorr=r�new_keyr�set_contents_from_file)r�fp�part_numrerfrgrhrir-rTrrrr�upload_part_from_file�s
�z%MultiPartUpload.upload_part_from_filec	Cs�|dkrtd��d|j|f}|dur2|dur2d||f}	|jjj}
|dur)i}n|��}|	||
j<|jj|j|||d||d�S)a�
        Copy another part of this MultiPart Upload.

        :type src_bucket_name: string
        :param src_bucket_name: Name of the bucket containing the source key

        :type src_key_name: string
        :param src_key_name: Name of the source key

        :type part_num: int
        :param part_num: The number of this part.

        :type start: int
        :param start: Zero-based byte offset to start copying from

        :type end: int
        :param end: Zero-based byte offset to copy to

        :type src_version_id: string
        :param src_version_id: version_id of source object to copy from

        :type headers: dict
        :param headers: Any headers to pass along in the request
        rbrcrdNzbytes=%s-%s)�src_version_idr@rerT)	rkr=rr�provider�copy�copy_source_range_header�copy_keyr)r�src_bucket_name�src_key_namero�start�endrqrerT�rngrrrrr�copy_part_from_keys"

�z"MultiPartUpload.copy_part_from_keycCs|��}|j�|j|j|�S)a.
        Complete the MultiPart Upload operation.  This method should
        be called when all parts of the file have been successfully
        uploaded to S3.

        :rtype: :class:`boto.s3.multipart.CompletedMultiPartUpload`
        :returns: An object representing the completed upload.
        )rFr�complete_multipart_uploadrr=)rrZrrr�complete_upload4s	
�zMultiPartUpload.complete_uploadcCs|j�|j|j�dS)a�
        Cancels a MultiPart Upload operation.  The storage consumed by
        any previously uploaded parts will be freed. However, if any
        part uploads are currently in progress, those part uploads
        might or might not succeed. As a result, it might be necessary
        to abort a given multipart upload multiple times in order to
        completely free all storage consumed by all parts.
        N)r�cancel_multipart_uploadrr=rrrr�
cancel_uploadAs	zMultiPartUpload.cancel_uploadr)NNN)NTNraNN)NNNN)r&r'r(r)rrrDrFrr$r3rpr{r}rrrrrr<�s&



�
�$
�-
r<r)�boto.s3rr�botor�xml.saxrZ�objectrr*r;r<rrrr�<module>s+
(

https://t.me/RX1948 - 2025