HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/s3transfer/__pycache__/copies.cpython-310.pyc
o

�h�8�@stddlZddlZddlmZmZmZmZddlmZm	Z	m
Z
mZGdd�de�ZGdd�de�Z
Gdd	�d	e�ZdS)
�N)�CompleteMultipartUploadTask�CreateMultipartUploadTask�SubmissionTask�Task)�ChunksizeAdjuster�calculate_range_parameter�
get_callbacks�get_filtered_dictc
@sxeZdZdZdddddddd	d
d�	Zgd�Zgd
�Zgd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�CopySubmissionTaskz+Task for submitting tasks to execute a copy�IfMatch�IfModifiedSince�IfNoneMatch�IfUnmodifiedSince�SSECustomerKey�SSECustomerAlgorithm�SSECustomerKeyMD5�RequestPayer�ExpectedBucketOwner)	�CopySourceIfMatch�CopySourceIfModifiedSince�CopySourceIfNoneMatch�CopySourceIfUnmodifiedSince�CopySourceSSECustomerKey�CopySourceSSECustomerAlgorithm�CopySourceSSECustomerKeyMD5rr)rrrrrrrrrrrr)	rrrrrrr�MetadataDirective�TaggingDirective)rrrrrcCs�|jjdur9|jj}|�|j�}|j}|��D]\}	}
|	|jvr'|
||j|	<q|jj	di|��}|j�
|d�|jj|jkrK|�|||||�dS|�
|||||�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
        N�
ContentLength�)�meta�size�	call_args�)_get_head_object_request_from_copy_source�copy_source�
extra_args�items�EXTRA_ARGS_TO_HEAD_ARGS_MAPPING�
source_client�head_object�provide_transfer_size�multipart_threshold�_submit_copy_request�_submit_multipart_request)�self�client�config�osutil�request_executor�transfer_futurer!�head_object_requestr$�param�value�responserr�G/usr/local/CyberPanel/lib/python3.10/site-packages/s3transfer/copies.py�_submitPs6��
���
��
�
�zCopySubmissionTask._submitc
CsL|jj}t|d�}|j�|t|j||j|j|j|j	||jj
d�dd��dS)N�progress)r.r#�bucket�keyr$�	callbacksr T)�transfer_coordinator�main_kwargs�is_final)rr!r�_transfer_coordinator�submit�CopyObjectTaskr#r:r;r$r )r-r.r/r0r1r2r!�progress_callbacksrrr7r+�s"
�	��z'CopySubmissionTask._submit_copy_requestcCsx|jj}i}|j��D]
\}}	||jvr|	||<q|j�|t|j||j|j	|d�d��}
|j
}t�}|�||jj
�}tt�|jj
t|���}
g}t|d�}td|
d�D]F}|�|j�}t||d|
|jj
�|d<|�||d|
|jj
�}|j�d�}|�|j�|t|j||j|j|j	|||||d�	d|
id	���qU|�|j�}|j�|t|j||j|j	|d�|
|d
�dd��dS)
N)r.r:r;r$)r=r>r9��CopySourceRange�ChecksumAlgorithm)	r.r#r:r;�part_numberr$r<r �checksum_algorithm�	upload_id)r=r>�pending_main_kwargs)rI�partsT)r=r>rJr?)rr!r$r%�CREATE_MULTIPART_ARGS_BLACKLISTr@rArr:r;�multipart_chunksizer�adjust_chunksizer �int�math�ceil�floatr�range�_extra_upload_part_argsr�_get_transfer_size�get�append�CopyPartTaskr#�_extra_complete_multipart_argsr)r-r.r/r0r1r2r!�create_multipart_extra_argsr4�val�create_multipart_future�	part_size�adjuster�	num_parts�part_futuresrCrG�extra_part_argsr rH�complete_multipart_extra_argsrrr7r,�s�
������
�������������z,CopySubmissionTask._submit_multipart_requestcCs(t|t�r
t�|�Std|t|�f��)NzZExpecting dictionary formatted: {"Bucket": bucket_name, "Key": key} but got %s or type %s.)�
isinstance�dict�copy�	TypeError�type)r-r#rrr7r"s


��z<CopySubmissionTask._get_head_object_request_from_copy_sourcecC�t||j�S�N)r	�UPLOAD_PART_COPY_ARGS�r-r$rrr7rTsz*CopySubmissionTask._extra_upload_part_argscCrhri)r	�COMPLETE_MULTIPART_ARGSrkrrr7rY#sz1CopySubmissionTask._extra_complete_multipart_argscCs||dkr|||S|S)NrDr)r-r]�
part_indexr_�total_transfer_sizerrr7rU&sz%CopySubmissionTask._get_transfer_sizeN)�__name__�
__module__�__qualname__�__doc__r&rjrLrlr8r+r,r"rTrYrUrrrr7r
s,�>l
r
c@seZdZdZdd�ZdS)rBzTask to do a nonmultipart copyc	Cs0|jd|||d�|��|D]}||d�qdS)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_transferredNr)�copy_object)	r-r.r#r:r;r$r<r �callbackrrr7�_main3s���zCopyObjectTask._mainN�rorprqrrrzrrrr7rB0srBc@seZdZdZ	ddd�ZdS)rXz)Task to upload a part in a multipart copyNcCsx|jd|||||d�|��}|D]}||	d�q|dd}
|
|d�}|
r:d|
����}||dvr:|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
        :param checksum_algorithm: The algorithm that was used to create the multipart
            upload

        :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. If a checksum is in the response,
            it will also be included.
        )rsrtru�UploadId�
PartNumberrv�CopyPartResult�ETag)rr}�ChecksumNr)�upload_part_copy�upper)r-r.r#r:r;rIrGr$r<r rHr6ry�etag�
part_metadata�checksum_memberrrr7rzLs(&��
�zCopyPartTask._mainrir{rrrr7rXIs
�rX)rerP�s3transfer.tasksrrrr�s3transfer.utilsrrrr	r
rBrXrrrr7�<module>s