Ë
    £ªði<  ã                   óž   — d dl Z d dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
 d dlmZmZmZmZ  G d„ de	«      Z G d„ d	e
«      Z G d
„ de
«      Zy)é    N)ÚClientError)ÚS3CopyFailedError)ÚCompleteMultipartUploadTaskÚCreateMultipartUploadTaskÚSubmissionTaskÚTask)ÚChunksizeAdjusterÚcalculate_range_parameterÚget_callbacksÚget_filtered_dictc            
       ój   — e Zd ZdZdddddddd	d
dœ	Zg d¢Zg d¢Zg d¢Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd„ Zy)ÚCopySubmissionTaskz+Task for submitting tasks to execute a copyÚIfMatchÚIfModifiedSinceÚIfNoneMatchÚIfUnmodifiedSinceÚSSECustomerKeyÚSSECustomerAlgorithmÚSSECustomerKeyMD5ÚRequestPayerÚExpectedBucketOwner)	ÚCopySourceIfMatchÚCopySourceIfModifiedSinceÚCopySourceIfNoneMatchÚCopySourceIfUnmodifiedSinceÚCopySourceSSECustomerKeyÚCopySourceSSECustomerAlgorithmÚCopySourceSSECustomerKeyMD5r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )	r   r   r   r   r   r   r   ÚMetadataDirectiveÚTaggingDirective)r   r   r   r   r   c                 ó¬  — |j                   j                  �|j                   j                  €Ú|j                   j                  }| j	                  |j
                  «      }|j                  }|j                  «       D ]&  \  }	}
|	| j                  v sŒ|
|| j                  |	   <   Œ(  |j                  j                  di |¤Ž}|j                   j                  |d   «       |j                   j                  |j                  d«      «       |j                   j                  |j                  k  r| j                  |||||«       y| j!                  |||||«       y)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ÚETag© )ÚmetaÚsizeÚetagÚ	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Úprovide_object_etagÚgetÚmultipart_thresholdÚ_submit_copy_requestÚ_submit_multipart_request)ÚselfÚclientÚconfigÚosutilÚrequest_executorÚtransfer_futurer(   Úhead_object_requestr+   ÚparamÚvalueÚresponses               úh/var/www/acinvestment.org/public_html/aci/backend/venv/lib/python3.12/site-packages/s3transfer/copies.pyÚ_submitzCopySubmissionTask._submitS   s^  € ð, × Ñ ×%Ñ%Ð-Ø×#Ñ#×(Ñ(Ð0ð (×,Ñ,×6Ñ6ˆIà×>Ñ>Ø×)Ñ)óð  ð
 #×-Ñ-ˆJð !+× 0Ñ 0Ó 2ò ‘��uØ˜D×@Ñ@Ò@ð ð (Ø×<Ñ<¸UÑCòðð ;�y×.Ñ.×:Ñ:ñ Ø%ñˆHð × Ñ ×6Ñ6Ø˜Ñ)ôð
 × Ñ ×4Ñ4°X·\±\À&Ó5IÔJð ×Ñ×$Ñ$ v×'AÑ'AÒAØ×%Ñ%Ø˜ Ð(8¸/õð ×*Ñ*Ø˜ Ð(8¸/õó    c                 ó4  — |j                   j                  }t        |d«      }| j                  j	                  |t        | j                  ||j                  |j                  |j                  |j                  ||j                   j                  dœd¬«      «       y )NÚprogress)r7   r*   ÚbucketÚkeyr+   Ú	callbacksr&   T)Útransfer_coordinatorÚmain_kwargsÚis_final)r%   r(   r   Ú_transfer_coordinatorÚsubmitÚCopyObjectTaskr*   rE   rF   r+   r&   )r6   r7   r8   r9   r:   r;   r(   Úprogress_callbackss           r@   r4   z'CopySubmissionTask._submit_copy_request–   s�   € ð $×(Ñ(×2Ñ2ˆ	ô +¨?¸JÓGÐð 	×"Ñ"×)Ñ)ØÜØ%)×%?Ñ%?à$Ø#,×#8Ñ#8Ø'×.Ñ.Ø$Ÿ=™=Ø"+×"6Ñ"6Ø!3Ø+×0Ñ0×5Ñ5ñð ôõ	
rB   c                 óŠ  — |j                   j                  }i }|j                  j                  «       D ]  \  }}	|| j                  vsŒ|	||<   Œ | j
                  j                  |t        | j
                  ||j                  |j                  |dœ¬«      «      }
|j                  }t        «       }|j                  ||j                   j                  «      }t        t        j                   |j                   j                  t#        |«      z  «      «      }g }t%        |d«      }t'        d|dz   «      D �]&  }| j)                  |j                  «      }t+        ||dz
  ||j                   j                  «      |d<   |j                   j,                  �|j                   j,                  |d<   | j/                  ||dz
  ||j                   j                  «      }|j                  j1                  d«      }|j3                  | j
                  j                  |t5        | j
                  ||j6                  |j                  |j                  |||||dœ	d	|
i¬
«      «      «       �Œ) | j9                  |j                  «      }| j
                  j                  |t;        | j
                  ||j                  |j                  |dœ|
|dœd¬«      «       y )N)r7   rE   rF   r+   )rH   rI   rD   é   ÚCopySourceRanger   ÚChecksumAlgorithm)	r7   r*   rE   rF   Úpart_numberr+   rG   r&   Úchecksum_algorithmÚ	upload_id)rH   rI   Úpending_main_kwargs)rU   ÚpartsT)rH   rI   rV   rJ   )r%   r(   r+   r,   ÚCREATE_MULTIPART_ARGS_BLACKLISTrK   rL   r   rE   rF   Úmultipart_chunksizer	   Úadjust_chunksizer&   ÚintÚmathÚceilÚfloatr   ÚrangeÚ_extra_upload_part_argsr
   r'   Ú_get_transfer_sizer2   ÚappendÚCopyPartTaskr*   Ú_extra_complete_multipart_argsr   )r6   r7   r8   r9   r:   r;   r(   Úcreate_multipart_extra_argsr=   ÚvalÚcreate_multipart_futureÚ	part_sizeÚadjusterÚ	num_partsÚpart_futuresrN   rS   Úextra_part_argsr&   rT   Úcomplete_multipart_extra_argss                        r@   r5   z,CopySubmissionTask._submit_multipart_request°   s×  € ð $×(Ñ(×2Ñ2ˆ	ð ')Ð#Ø#×.Ñ.×4Ñ4Ó6ò 	9‰JˆE�3Ø˜D×@Ñ@Ò@Ø58Ð+¨EÒ2ð	9ð #'×"<Ñ"<×"CÑ"CØÜ%Ø%)×%?Ñ%?à$Ø'×.Ñ.Ø$Ÿ=™=Ø"=ñ	ôó#
Ðð ×.Ñ.ˆ	Ü$Ó&ˆØ×-Ñ-Ø�×+Ñ+×0Ñ0ó
ˆ	ô Ü�I‰I�o×*Ñ*×/Ñ/´%¸	Ó2BÑBÓCó
ˆ	ð
 ˆÜ*¨?¸JÓGÐä   I°¡MÓ2ó 0	ˆKØ"×:Ñ:Ø×$Ñ$óˆOô 2KØØ˜a‘ØØ×$Ñ$×)Ñ)ó	2ˆOÐ-Ñ.ð ×#Ñ#×(Ñ(Ð4à#×(Ñ(×-Ñ-ð  Ð 3Ñ4ð
 ×*Ñ*ØØ˜a‘ØØ×$Ñ$×)Ñ)ó	ˆDð "+×!5Ñ!5×!9Ñ!9Ð:MÓ!NÐØ×ÑØ×*Ñ*×1Ñ1Ø$Ü Ø-1×-GÑ-Gà&,Ø+4×+@Ñ+@Ø&/×&6Ñ&6Ø#,§=¡=Ø+6Ø*9Ø);Ø$(Ø2Dñ
%ð (Ð)@ð-ôóöð70	ðd )-×(KÑ(KØ× Ñ ó)
Ð%ð 	×"Ñ"×)Ñ)ØÜ'Ø%)×%?Ñ%?à$Ø'×.Ñ.Ø$Ÿ=™=Ø"?ñ	ð "9Ø)ñ%ð ôõ	
rB   c                 ó‚   — t        |t        «      rt        j                  |«      S t        d|› dt	        |«      › d�«      ‚)NzLExpecting dictionary formatted: {"Bucket": bucket_name, "Key": key} but got z	 or type ú.)Ú
isinstanceÚdictÚcopyÚ	TypeErrorÚtype)r6   r*   s     r@   r)   z<CopySubmissionTask._get_head_object_request_from_copy_source   sF   € Ü�k¤4Ô(Ü—9‘9˜[Ó)Ð)äðà&˜- y´°kÓ1BÐ0CÀ1ðFóð rB   c                 ó.   — t        || j                  «      S ©N)r   ÚUPLOAD_PART_COPY_ARGS©r6   r+   s     r@   r`   z*CopySubmissionTask._extra_upload_part_args*  s   € ô ! ¨T×-GÑ-GÓHÐHrB   c                 ó.   — t        || j                  «      S rv   )r   ÚCOMPLETE_MULTIPART_ARGSrx   s     r@   rd   z1CopySubmissionTask._extra_complete_multipart_args/  s   € Ü  ¨T×-IÑ-IÓJÐJrB   c                 ó&   — ||dz
  k(  r|||z  z
  S |S )NrP   r$   )r6   rh   Ú
part_indexrj   Útotal_transfer_sizes        r@   ra   z%CopySubmissionTask._get_transfer_size2  s(   € ð ˜ Q™Ò&ð '¨*°yÑ*@ÑAÐAØÐrB   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   rw   rX   rz   rA   r4   r5   r)   r`   rd   ra   r$   rB   r@   r   r   !   sk   „ Ù5ð 'Ø%6Ø!.Ø':Ø$4Ø*@Ø':Ø&Ø4ñ
'Ð#òÐò
'Ð#òÐòAòF
ò4n
ò`òIò
KórB   r   c                   ó   — e Zd ZdZd„ Zy)rM   zTask to do a nonmultipart copyc                 óP   —  |j                   d|||dœ|¤Ž |D ]  } ||¬«       Œ y)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)	r6   r7   r*   rE   rF   r+   rG   r&   Úcallbacks	            r@   Ú_mainzCopyObjectTask._main?  sA   € ð 	ˆ×Ñð 	
Ø"¨6°sñ	
Ø>Hò	
ð "ò 	-ˆHÙ tÖ,ñ	-rB   N©r~   r   r€   r�   r‹   r$   rB   r@   rM   rM   <  s
   „ Ù(ó-rB   rM   c                   ó   — e Zd ZdZ	 dd„Zy)rc   z)Task to upload a part in a multipart copyNc           	      ó|  — 	  |j                   d|||||dœ|¤Ž}|D ]  } ||	¬«       Œ |d   d   }||dœ}|
r%d|
j                  «       › �}||d   v r|d   |   ||<   |S # t        $ rR}|j                  j                  di «      j                  d«      }|d   }|d   }|dk(  rt	        d|› d|› d	�«      ‚‚ d
}~ww xY w)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.
        )r„   r…   r†   ÚUploadIdÚ
PartNumberÚErrorÚCoder†   r…   ÚPreconditionFailedzContents of stored object "z" in bucket "z" did not match expected ETag.Nr‡   ÚCopyPartResultr#   )r#   r�   ÚChecksumr$   )Úupload_part_copyr   r?   r2   r   Úupper)r6   r7   r*   rE   rF   rU   rS   r+   rG   r&   rT   r?   ÚeÚ
error_codeÚsrc_keyÚ
src_bucketrŠ   r'   Úpart_metadataÚchecksum_members                       r@   r‹   zCopyPartTask._mainX  s.  € ðL	Ø.�v×.Ñ.ð Ø&ØØØ"Ø&ñð ñˆHð( "ò 	-ˆHÙ tÖ,ð	-àÐ(Ñ)¨&Ñ1ˆØ!%°[ÑAˆÙØ (Ð);×)AÑ)AÓ)CÐ(DÐEˆOØ (Ð+;Ñ"<Ñ<Ø19Ð:JÑ1KØ#ñ2�˜oÑ.ð Ðøô- ò 	ØŸ™Ÿ™¨°Ó4×8Ñ8¸Ó@ˆJØ! %Ñ(ˆGØ$ XÑ.ˆJØÐ1Ò1Ü'Ø1°'°ð ;"Ø", ð .%ð%óð ð ûð	ús   ‚A  Á 	B;Á)AB6Â6B;rv   rŒ   r$   rB   r@   rc   rc   U  s   „ Ù3ð  ôErB   rc   )rr   r\   Úbotocore.exceptionsr   Ús3transfer.exceptionsr   Ús3transfer.tasksr   r   r   r   Ús3transfer.utilsr	   r
   r   r   r   rM   rc   r$   rB   r@   ú<module>r¢      sP   ðó Û å +å 3÷ó ÷ó ôX˜ô Xôv-�Tô -ô2H�4õ HrB   