ó {r Qc@s†ddlZddlZddlmZddlZdefd„ƒYZdefd„ƒYZdd„Z defd „ƒYZ dS( iÿÿÿÿN(thandlertCompleteMultiPartUploadcBs5eZdZdd„Zd„Zd„Zd„ZRS(sÙ Represents a completed MultiPart Upload. Contains the following useful attributes: * location - The URI of the completed upload * bucket_name - The name of the bucket in which the upload is contained * key_name - The name of the new, completed key * etag - The MD5 hash of the completed, combined upload * version_id - The version_id of the completed upload * encrypted - The value of the encryption header cCsC||_d|_d|_d|_d|_d|_d|_dS(N(tbuckettNonetlocationt bucket_nametkey_nametetagt version_idt encrypted(tselfR((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt__init__-s      cCsd|j|jfS(Ns (RR(R ((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt__repr__6s cCsdS(N(R(R tnametattrst connection((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt startElement:scCst|dkr||_nX|dkr0||_n@|dkrH||_n(|dkr`||_nt|||ƒdS(NtLocationtBuckettKeytETag(RRRRtsetattr(R R tvalueR((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt endElement=s        N(t__name__t __module__t__doc__RR R RR(((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyRs    tPartcBs5eZdZdd„Zd„Zd„Zd„ZRS(s Represents a single part in a MultiPart upload. Attributes include: * part_number - The integer part number * last_modified - The last modified date of this part * etag - The MD5 hash of this part * size - The size, in bytes, of this part cCs1||_d|_d|_d|_d|_dS(N(RRt part_numbert last_modifiedRtsize(R R((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR Us     cCs%t|jtƒrd|jSdSdS(Ns s s (t isinstanceRtintR(R ((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR \s cCsdS(N(R(R R RR((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyRbscCs€|dkrt|ƒ|_n^|dkr6||_nF|dkrN||_n.|dkrlt|ƒ|_nt|||ƒdS(Nt PartNumbert LastModifiedRtSize(R RRRRR(R R RR((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyRes      N(RRRRR R RR(((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyRJs     ccsWt}d}xD|rR|jd|ƒ}x|D] }|Vq.W|j}|j}qWdS(sG A generator function for listing parts of a multipart upload. N(tTrueRt get_all_partstnext_part_number_markert is_truncated(tmpuploadtpart_number_markert more_resultstparttparts((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt part_listerrs    tMultiPartUploadcBs˜eZdZd d„Zd„Zd„Zd„Zd„Zd„Z d d d„Z d e d dd d d „Z d d d d d „Z d „Zd „ZRS(s2 Represents a MultiPart Upload operation. cCsy||_d|_d|_t|_d|_d|_d|_d|_d|_ d|_ d|_ t |_ d|_dS(N(RRRRtidt initiatortownert storage_classt initiatedR)R&t max_partstFalseR't_parts(R R((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR …s            cCs d|jS(Ns(R(R ((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR ”scCs t|ƒS(N(R-(R ((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyt__iter__—scCs[d}xD|D]<}|d7}|d|j7}|d|j7}|d7}q W|d7}|S(Ns s s %d s %s s s(RR(R tsR+((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pytto_xmlšs   cCs}|dkr%tj|ƒ|_|jS|dkrJtj|ƒ|_|jS|dkryt|jƒ}|jj|ƒ|SdS(Nt InitiatortOwnerR( tusertUserR0R1RRR6tappendR(R R RRR+((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR¤s   cCs |dkr||_nî|dkr0||_nÖ|dkrH||_n¾|dkr`||_n¦|dkrx||_nŽ|dkr||_nv|dkr®t|ƒ|_nX|dkrÞ|d krÒt|_ qt |_ n(|d krö||_ nt |||ƒdS( NRRtUploadIdt StorageClasstPartNumberMarkertNextPartNumberMarkertMaxPartst IsTruncatedttruet Initiated( RRR/R2R)R&R R4R$R'R5R3R(R R RR((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR±s*                   cCs¹g|_d|j}|r-|d|7}n|rD|d|7}n|jjjd|jj|jd|ƒ}|jƒ}|jdkrµt j ||ƒ}t j j ||ƒ|jSdS(s@ Return the uploaded parts of this MultiPart Upload. This is a lower-level method that requires you to manually page through results. To simplify this process, you can just use the object itself as an iterator and it will automatically handle all of the paging with S3. s uploadId=%ss &max-parts=%ds&part-number-marker=%stGETt query_argsiÈN(R6R/RRt make_requestR RtreadtstatusRt XmlHandlertxmltsaxt parseString(R R4R)RHtresponsetbodyth((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pyR%Ês     i c Cs„|dkrtdƒ‚nd|j|f} |jj|jƒ} | j|d|d|d|d|d|d td | d |ƒd S( sZ Upload another part of this MultiPart Upload. :type fp: file :param fp: The file object you want to upload. :type part_num: int :param part_num: The number of this part. The other parameters are exactly as defined for the :class:`boto.s3.key.Key` set_contents_from_file method. is&Part numbers must be greater than zerosuploadId=%s&partNumber=%dtheaderstreplacetcbtnum_cbtmd5treduced_redundancyRHRN(t ValueErrorR/Rtnew_keyRtset_contents_from_fileR5( R tfptpart_numRSRTRURVRWRRHtkey((s4/tmp/tmp.yUYbTOKr8o/gsutil/boto/boto/s3/multipart.pytupload_part_from_fileás c CsÇ|dkrtdƒ‚nd|j|f}|d k r–|d k r–d||f} |jjj} |d krzi}n |jƒ}| || js   +(