ó V!¶\c@sÞddlZddlZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z d efd „ƒYZ d efd „ƒYZ defd„ƒYZdS(iÿÿÿÿN(tTask(tSubmissionTask(tCreateMultipartUploadTask(tCompleteMultipartUploadTask(t get_callbacks(tcalculate_range_parameter(tget_filtered_dict(tChunksizeAdjustertCopySubmissionTaskc BsÙeZdZidd6dd6dd6dd6d d 6d d 6d d6dd6Zddddd d dd d d dg Zddddd d ddgZdgZd„Zd„Zd„Z d„Z d„Z d„Z d„Z RS(s+Task for submitting tasks to execute a copytIfMatchtCopySourceIfMatchtIfModifiedSincetCopySourceIfModifiedSincet IfNoneMatchtCopySourceIfNoneMatchtIfUnmodifiedSincetCopySourceIfUnmodifiedSincetSSECustomerKeytCopySourceSSECustomerKeytSSECustomerAlgorithmtCopySourceSSECustomerAlgorithmtSSECustomerKeyMD5tCopySourceSSECustomerKeyMD5t RequestPayertMetadataDirectivec Csð|jjdkr¢|jj}|j|jƒ}|j}x=|jƒD]/\} } | |jkrF| ||j| (R)R*R+R,R-R.Rtcreate_multipart_extra_argsR0tvaltcreate_multipart_futuret part_sizetadjustert num_partst part_futuresR?RAtextra_part_argsRtcomplete_multipart_extra_args((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyR(”sx       "               cCs<t|tƒrtj|ƒStd|t|ƒfƒ‚dS(NsZExpecting dictionary formatted: {"Bucket": bucket_name, "Key": key} but got %s or type %s.(t isinstancetdicttcopyt TypeErrorttype(R)R((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRñs  cCst||jƒS(N(RtUPLOAD_PART_COPY_ARGS(R)R ((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRMüscCst||jƒS(N(RtCOMPLETE_MULTIPART_ARGS(R)R ((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRQscCs ||dkr|||S|S(Ni((R)RUt part_indexRWttotal_transfer_size((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRNs (t__name__t __module__t__doc__R"R`RERaR3R'R(RRMRQRN(((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRsJ     6  ]  R=cBseZdZd„ZRS(sTask to do a nonmultipart copyc CsA|jd|d|d||x|D]}|d|ƒq&WdS(sÿ :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 t CopySourcetBuckettKeytbytes_transferredN(t copy_object( R)R*RR7R8R R9Rtcallback((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyt_mains  (RdReRfRm(((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyR= sRPcBseZdZd„ZRS(s)Task to upload a part in a multipart copyc Csk|jd|d|d|d|d||} x|D]} | d| ƒq4W| dd} i| d6|d6S( sŠ :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. RgRhRitUploadIdt PartNumberRjtCopyPartResulttETag(tupload_part_copy( R)R*RR7R8RCRAR R9RR2Rltetag((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRm%s  (RdReRfRm(((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyRP#s(R]RIts3transfer.tasksRRRRts3transfer.utilsRRRRRR=RP(((s7/tmp/pip-install-usGedi/s3transfer/s3transfer/copies.pyt s  ó