3ńZc@sddlZddlZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z d efd YZ d efd YZ defdYZdS(iN(tTask(tSubmissionTask(tCreateMultipartUploadTask(tCompleteMultipartUploadTask(t get_callbacks(tcalculate_range_parameter(tget_filtered_dict(tChunksizeAdjustertCopySubmissionTaskc BseZdZidd6dd6dd6dd6d d 6d d 6d d6dd6Zddddd d dd d d dg Zddddd d ddgZdgZdZdZdZ dZ dZ dZ dZ RS(s+Task for submitting tasks to execute a copytIfMatchtCopySourceIfMatchtIfModifiedSincetCopySourceIfModifiedSincet IfNoneMatchtCopySourceIfNoneMatchtIfUnmodifiedSincetCopySourceIfUnmodifiedSincetSSECustomerKeytCopySourceSSECustomerKeytSSECustomerAlgorithmtCopySourceSSECustomerAlgorithmtSSECustomerKeyMD5tCopySourceSSECustomerKeyMD5t RequestPayertMetadataDirectivec Cs|jjdkr|jj}|j|j}|j}x=|jD]/\} } | |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((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyR(sx       "               cCs<t|trtj|Std|t|fdS(NsZExpecting dictionary formatted: {"Bucket": bucket_name, "Key": key} but got %s or type %s.(t isinstancetdicttcopyt TypeErrorttype(R)R((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRs  cCst||jS(N(RtUPLOAD_PART_COPY_ARGS(R)R ((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRMscCst||jS(N(RtCOMPLETE_MULTIPART_ARGS(R)R ((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRQscCs ||dkr|||S|S(Ni((R)RUt part_indexRWttotal_transfer_size((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRNs (t__name__t __module__t__doc__R"R`RERaR3R'R(RRMRQRN(((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRsJ     6  ]  R=cBseZdZdZRS(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((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyt_mains  (RdReRfRm(((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyR= sRPcBseZdZdZRS(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((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRm%s  (RdReRfRm(((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyRP#s(R]RIts3transfer.tasksRRRRts3transfer.utilsRRRRRR=RP(((s5/usr/lib/python2.7/site-packages/s3transfer/copies.pyt s