Ë
    Ø<óe‡8  ã                   ó†   — d dl Z d dl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)Ú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                  «       D ]&  \  }	}
|	| j                  v sŒ|
|| j                  |	   <   Œ(  |j                  j                  di |¤Ž}|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© )Ú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Úresponses               ú3/usr/lib/python3/dist-packages/s3transfer/copies.pyÚ_submitzCopySubmissionTask._submitP   s-  € ð, ×Ñ×$Ñ$Ð,ð (×,Ñ,×6Ñ6ˆIà×>Ñ>Ø×)Ñ)óð  ð
 #×-Ñ-ˆJð !+× 0Ñ 0Ó 2ò ‘��uØ˜D×@Ñ@Ò@ð ð (Ø×<Ñ<¸UÑCòðð ;�y×.Ñ.×:Ñ:ñ Ø%ñˆHð × Ñ ×6Ñ6Ø˜Ñ)ôð ×Ñ×$Ñ$ 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)r1   r&   ÚbucketÚkeyr'   Ú	callbacksr#   T)Útransfer_coordinatorÚmain_kwargsÚis_final)r"   r$   r	   Ú_transfer_coordinatorÚsubmitÚCopyObjectTaskr&   r?   r@   r'   r#   )r0   r1   r2   r3   r4   r5   r$   Úprogress_callbackss           r:   r.   z'CopySubmissionTask._submit_copy_requestŽ   s�   € ð $×(Ñ(×2Ñ2ˆ	ô +¨?¸JÓGÐð 	×"Ñ"×)Ñ)ØÜØ%)×%?Ñ%?à$Ø#,×#8Ñ#8Ø'×.Ñ.Ø$Ÿ=™=Ø"+×"6Ñ"6Ø!3Ø+×0Ñ0×5Ñ5ñð ôõ	
r<   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-                  ||dz
  ||j                   j                  «      }|j                  j/                  d«      }|j1                  | j
                  j                  |t3        | j
                  ||j4                  |j                  |j                  |||||dœ	d|
i¬	«      «      «       Œø | j7                  |j                  «      }| j
                  j                  |t9        | j
                  ||j                  |j                  |dœ|
|d
œd¬«      «       y )N)r1   r?   r@   r'   )rB   rC   r>   é   ÚCopySourceRangeÚChecksumAlgorithm)	r1   r&   r?   r@   Úpart_numberr'   rA   r#   Úchecksum_algorithmÚ	upload_id)rB   rC   Úpending_main_kwargs)rO   ÚpartsT)rB   rC   rP   rD   )r"   r$   r'   r(   ÚCREATE_MULTIPART_ARGS_BLACKLISTrE   rF   r   r?   r@   Úmultipart_chunksizer   Úadjust_chunksizer#   ÚintÚmathÚceilÚfloatr	   ÚrangeÚ_extra_upload_part_argsr   Ú_get_transfer_sizeÚgetÚappendÚCopyPartTaskr&   Ú_extra_complete_multipart_argsr   )r0   r1   r2   r3   r4   r5   r$   Úcreate_multipart_extra_argsr7   ÚvalÚcreate_multipart_futureÚ	part_sizeÚadjusterÚ	num_partsÚpart_futuresrH   rM   Úextra_part_argsr#   rN   Úcomplete_multipart_extra_argss                        r:   r/   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ò ,	ˆKØ"×:Ñ:Ø×$Ñ$óˆOô 2KØØ˜a‘ØØ×$Ñ$×)Ñ)ó	2ˆOÐ-Ñ.ð ×*Ñ*ØØ˜a‘ØØ×$Ñ$×)Ñ)ó	ˆDð "+×!5Ñ!5×!9Ñ!9Ð:MÓ!NÐØ×ÑØ×*Ñ*×1Ñ1Ø$Ü Ø-1×-GÑ-Gà&,Ø+4×+@Ñ+@Ø&/×&6Ñ&6Ø#,§=¡=Ø+6Ø*9Ø);Ø$(Ø2Dñ
%ð (Ð)@ð-ôóõð/,	ð\ )-×(KÑ(KØ× Ñ ó)
Ð%ð 	×"Ñ"×)Ñ)ØÜ'Ø%)×%?Ñ%?à$Ø'×.Ñ.Ø$Ÿ=™=Ø"?ñ	ð "9Ø)ñ%ð ôõ	
r<   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)r0   r&   s     r:   r%   z<CopySubmissionTask._get_head_object_request_from_copy_source  s:   € Ü�k¤4Ô(Ü—9‘9˜[Ó)Ð)åò -8¼¸kÕ9JðLóð r<   c                 ó.   — t        || j                  «      S ©N)r
   ÚUPLOAD_PART_COPY_ARGS©r0   r'   s     r:   rZ   z*CopySubmissionTask._extra_upload_part_args  s   € ô ! ¨T×-GÑ-GÓHÐHr<   c                 ó.   — t        || j                  «      S rq   )r
   ÚCOMPLETE_MULTIPART_ARGSrs   s     r:   r_   z1CopySubmissionTask._extra_complete_multipart_args#  s   € Ü  ¨T×-IÑ-IÓJÐJr<   c                 ó&   — ||dz
  k(  r|||z  z
  S |S )NrJ   r!   )r0   rc   Ú
part_indexre   Útotal_transfer_sizes        r:   r[   z%CopySubmissionTask._get_transfer_size&  s(   € ð ˜ Q™Ò&ð '¨*°yÑ*@ÑAÐAØÐr<   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   rr   rR   ru   r;   r.   r/   r%   rZ   r_   r[   r!   r<   r:   r   r      sj   „ Ù5ð 'Ø%6Ø!.Ø':Ø$4Ø*@Ø':Ø&Ø4ñ
'Ð#òÐò
'Ð#òÐò<ò|
ò4j
òXòIò
Kór<   r   c                   ó   — e Zd ZdZd„ Zy)rG   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)	r0   r1   r&   r?   r@   r'   rA   r#   Úcallbacks	            r:   Ú_mainzCopyObjectTask._main3  sA   € ð 	ˆ×Ñð 	
Ø"¨6°sñ	
Ø>Hò	
ð "ò 	-ˆHÙ tÖ,ñ	-r<   N©ry   rz   r{   r|   r†   r!   r<   r:   rG   rG   0  s
   „ Ù(ó-r<   rG   c                   ó   — e Zd ZdZ	 dd„Zy)r^   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 )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Ú
PartNumberr‚   ÚCopyPartResultÚETag)r�   r‹   ÚChecksumr!   )Úupload_part_copyÚupper)r0   r1   r&   r?   r@   rO   rM   r'   rA   r#   rN   r9   r…   ÚetagÚpart_metadataÚchecksum_members                   r:   r†   zCopyPartTask._mainL  s°   € ðL +�6×*Ñ*ð 
Ø"ØØØØ"ñ
ð ñ
ˆð "ò 	-ˆHÙ tÖ,ð	-àÐ(Ñ)¨&Ñ1ˆØ!%°[ÑAˆÙØ (Ð);×)AÑ)AÓ)CÐ(DÐEˆOØ (Ð+;Ñ"<Ñ<Ø19Ð:JÑ1KØ#ñ2�˜oÑ.ð Ðr<   rq   r‡   r!   r<   r:   r^   r^   I  s   „ Ù3ð  ô8r<   r^   )rm   rV   Ús3transfer.tasksr   r   r   r   Ús3transfer.utilsr   r   r	   r
   r   rG   r^   r!   r<   r:   ú<module>r–      sH   ðó Û ÷ó ÷ó ôO˜ô Oôd-�Tô -ô2;�4õ ;r<   