HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/thread-self/root/lib/python3.6/site-packages/s3transfer/__pycache__/copies.cpython-36.pyc
3

\��_�3�@s�ddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZGd
d�de�ZGdd
�d
e�Z
Gdd�de�ZdS)�N)�Task)�SubmissionTask)�CreateMultipartUploadTask)�CompleteMultipartUploadTask)�
get_callbacks)�calculate_range_parameter)�get_filtered_dict)�ChunksizeAdjusterc@s�eZdZdZdddddddd	d
�Zddd
dddddddd	gZddd
ddddddg	Zd	gZdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d d!�Zd"S)#�CopySubmissionTaskz+Task for submitting tasks to execute a copyZIfMatchZIfModifiedSinceZIfNoneMatchZIfUnmodifiedSinceZSSECustomerKeyZSSECustomerAlgorithmZSSECustomerKeyMD5�RequestPayer)�CopySourceIfMatch�CopySourceIfModifiedSince�CopySourceIfNoneMatch�CopySourceIfUnmodifiedSince�CopySourceSSECustomerKey�CopySourceSSECustomerAlgorithm�CopySourceSSECustomerKeyMD5rrr
rrrrrZMetadataDirectiveZTaggingDirectivecCs�|jjdkrr|jj}|j|j�}|j}x,|j�D] \}	}
|	|jkr0|
||j|	<q0W|jj	f|�}|jj
|d�|jj|jkr�|j|||||�n|j
|||||�dS)a�
        :param client: The client associated with the transfer manager

        :type config: s3transfer.manager.TransferConfig
        :param config: The transfer config associated with the transfer
            manager

        :type osutil: s3transfer.utils.OSUtil
        :param osutil: The os utility associated to the transfer manager

        :type request_executor: s3transfer.futures.BoundedExecutor
        :param request_executor: The request executor associated with the
            transfer manager

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The transfer future associated with the
            transfer request that tasks are being submitted for
        NZ
ContentLength)�meta�size�	call_args�)_get_head_object_request_from_copy_source�copy_source�
extra_args�items�EXTRA_ARGS_TO_HEAD_ARGS_MAPPINGZ
source_clientZhead_objectZprovide_transfer_sizeZmultipart_threshold�_submit_copy_request�_submit_multipart_request)�self�client�config�osutil�request_executor�transfer_futurerZhead_object_requestr�param�value�response�r&�/usr/lib/python3.6/copies.py�_submitFs"

zCopySubmissionTask._submitcCsL|jj}t|d�}|jj|t|j||j|j|j|j	||jj
d�dd��dS)N�progress)rr�bucket�keyr�	callbacksrT)�transfer_coordinator�main_kwargs�is_final)rrr�_transfer_coordinator�submit�CopyObjectTaskrr*r+rr)rrrr r!r"r�progress_callbacksr&r&r'r|s

z'CopySubmissionTask._submit_copy_requestcCsr|jj}i}x(|jj�D]\}}	||jkr|	||<qW|jj|t|j||j|j	|d�d��}
|j
}t�}|j||jj
�}ttj|jj
t|���}
g}t|d�}x�td|
d�D]~}|j|j�}t||d|
|jj
�|d<|j||d|
|jj
�}|j|jj|t|j||j|j|j	||||d�d|
id���q�W|j|j�}|jj|t|j||j|j	|d�|
|d	�d
d��dS)N)rr*r+r)r-r.r)�ZCopySourceRange)rrr*r+�part_numberrr,r�	upload_id)r-r.�pending_main_kwargs)r6�partsT)r-r.r7r/)rrrr�CREATE_MULTIPART_ARGS_BLACKLISTr0r1rr*r+Zmultipart_chunksizer	Zadjust_chunksizer�int�mathZceil�floatr�range�_extra_upload_part_argsr�_get_transfer_size�append�CopyPartTaskr�_extra_complete_multipart_argsr)rrrr r!r"rZcreate_multipart_extra_argsr#�valZcreate_multipart_future�	part_sizeZadjuster�	num_partsZpart_futuresr3r5Zextra_part_argsrZcomplete_multipart_extra_argsr&r&r'r�sn

z,CopySubmissionTask._submit_multipart_requestcCs,t|t�rtj|�Std|t|�f��dS)NzZExpecting dictionary formatted: {"Bucket": bucket_name, "Key": key} but got %s or type %s.)�
isinstance�dict�copy�	TypeError�type)rrr&r&r'r�s


z<CopySubmissionTask._get_head_object_request_from_copy_sourcecCst||j�S)N)r�UPLOAD_PART_COPY_ARGS)rrr&r&r'r>�sz*CopySubmissionTask._extra_upload_part_argscCst||j�S)N)r�COMPLETE_MULTIPART_ARGS)rrr&r&r'rBsz1CopySubmissionTask._extra_complete_multipart_argscCs||dkr|||S|S)Nr4r&)rrDZ
part_indexrEZtotal_transfer_sizer&r&r'r?sz%CopySubmissionTask._get_transfer_sizeN)�__name__�
__module__�__qualname__�__doc__rrKr9rLr(rrrr>rBr?r&r&r&r'r
sJ6]r
c@seZdZdZdd�ZdS)r2zTask to do a nonmultipart copyc	Cs4|jf|||d�|��x|D]}||d�qWdS)a�
        :param client: The client to use when calling PutObject
        :param copy_source: The CopySource parameter to use
        :param bucket: The name of the bucket to copy to
        :param key: The name of the key to copy to
        :param extra_args: A dictionary of any extra arguments that may be
            used in the upload.
        :param callbacks: List of callbacks to call after copy
        :param size: The size of the transfer. This value is passed into
            the callbacks

        )�
CopySource�Bucket�Key)�bytes_transferredN)Zcopy_object)	rrrr*r+rr,r�callbackr&r&r'�_mains
zCopyObjectTask._mainN)rMrNrOrPrVr&r&r&r'r2sr2c@seZdZdZdd�ZdS)rAz)Task to upload a part in a multipart copyc

CsJ|jf|||||d�|��}
x|D]}||	d�q"W|
dd}||d�S)a�
        :param client: The client to use when calling PutObject
        :param copy_source: The CopySource parameter to use
        :param bucket: The name of the bucket to upload to
        :param key: The name of the key to upload to
        :param upload_id: The id of the upload
        :param part_number: The number representing the part of the multipart
            upload
        :param extra_args: A dictionary of any extra arguments that may be
            used in the upload.
        :param callbacks: List of callbacks to call after copy part
        :param size: The size of the transfer. This value is passed into
            the callbacks

        :rtype: dict
        :returns: A dictionary representing a part::

            {'Etag': etag_value, 'PartNumber': part_number}

            This value can be appended to a list to be used to complete
            the multipart upload.
        )rQrRrSZUploadId�
PartNumber)rTZCopyPartResult�ETag)rXrW)Zupload_part_copy)
rrrr*r+r6r5rr,rr%rUZetagr&r&r'rV&s
zCopyPartTask._mainN)rMrNrOrPrVr&r&r&r'rA$srA)rHr;Zs3transfer.tasksrrrrZs3transfer.utilsrrrr	r
r2rAr&r&r&r'�<module>
su