Ë
    Ø<óe)w  ã                   ó$  — d dl Z d dlmZ d dlmZ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«      Z G d	„ d
«      Z G d„ d«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy)é    N)ÚBytesIO©ÚreadableÚseekable)ÚIN_MEMORY_UPLOAD_TAG)ÚCompleteMultipartUploadTaskÚCreateMultipartUploadTaskÚSubmissionTaskÚTask)ÚChunksizeAdjusterÚDeferredOpenFileÚget_callbacksÚget_filtered_dictc                   ó&   — e Zd Zdd„Zd„ Zd„ Zd„ Zy)ÚAggregatedProgressCallbackc                 ó.   — || _         || _        d| _        y)aØ  Aggregates progress updates for every provided progress callback

        :type callbacks: A list of functions that accepts bytes_transferred
            as a single argument
        :param callbacks: The callbacks to invoke when threshold is reached

        :type threshold: int
        :param threshold: The progress threshold in which to take the
            aggregated progress and invoke the progress callback with that
            aggregated progress total
        r   N)Ú
_callbacksÚ
_thresholdÚ_bytes_seen)ÚselfÚ	callbacksÚ	thresholds      ú3/usr/lib/python3/dist-packages/s3transfer/upload.pyÚ__init__z#AggregatedProgressCallback.__init__!   s   € ð $ˆŒØ#ˆŒØˆÕó    c                 ó‚   — | xj                   |z  c_         | j                   | j                  k\  r| j                  «        y y ©N)r   r   Ú_trigger_callbacks)r   Úbytes_transferreds     r   Ú__call__z#AggregatedProgressCallback.__call__1   s7   € Ø×ÒÐ-Ñ-ÕØ×Ñ˜tŸ™Ò.Ø×#Ñ#Õ%ð /r   c                 óD   — | j                   dkD  r| j                  «        yy)z@Flushes out any progress that has not been sent to its callbacksr   N)r   r   ©r   s    r   Úflushz AggregatedProgressCallback.flush6   s!   € à×Ñ˜aÒØ×#Ñ#Õ%ð  r   c                 óZ   — | j                   D ]  } || j                  ¬«       Œ d| _        y )N)r   r   )r   r   )r   Úcallbacks     r   r   z-AggregatedProgressCallback._trigger_callbacks;   s+   € ØŸ™ò 	9ˆHÙ t×'7Ñ'7Ö8ð	9àˆÕr   N)i   )Ú__name__Ú
__module__Ú__qualname__r   r    r#   r   © r   r   r   r       s   „ óò &ò
&ó
r   r   c                   ó>   — e Zd ZdZd„ Zd
d„Zdd„Zd„ Zd„ Zd„ Z	d	„ Z
y)ÚInterruptReaderaÏ  Wrapper that can interrupt reading using an error

    It uses a transfer coordinator to propagate an error if it notices
    that a read is being made while the file is being read from.

    :type fileobj: file-like obj
    :param fileobj: The file-like object to read from

    :type transfer_coordinator: s3transfer.futures.TransferCoordinator
    :param transfer_coordinator: The transfer coordinator to use if the
        reader needs to be interrupted.
    c                 ó    — || _         || _        y r   )Ú_fileobjÚ_transfer_coordinator)r   ÚfileobjÚtransfer_coordinators      r   r   zInterruptReader.__init__O   s   € ØˆŒØ%9ˆÕ"r   Nc                 ó�   — | j                   j                  r| j                   j                  ‚| j                  j                  |«      S r   )r.   Ú	exceptionr-   Úread)r   Úamounts     r   r3   zInterruptReader.readS   s:   € ð ×%Ñ%×/Ò/Ø×,Ñ,×6Ñ6Ð6Ø�}‰}×!Ñ! &Ó)Ð)r   c                 ó<   — | j                   j                  ||«       y r   )r-   Úseek)r   ÚwhereÚwhences      r   r6   zInterruptReader.seek]   s   € Ø�‰×Ñ˜5 &Õ)r   c                 ó6   — | j                   j                  «       S r   )r-   Útellr"   s    r   r:   zInterruptReader.tell`   s   € Ø�}‰}×!Ñ!Ó#Ð#r   c                 ó8   — | j                   j                  «        y r   )r-   Úcloser"   s    r   r<   zInterruptReader.closec   s   € Ø�‰×ÑÕr   c                 ó   — | S r   r)   r"   s    r   Ú	__enter__zInterruptReader.__enter__f   s   € Øˆr   c                 ó$   — | j                  «        y r   )r<   )r   ÚargsÚkwargss      r   Ú__exit__zInterruptReader.__exit__i   s   € Ø�
‰
�r   r   )r   )r&   r'   r(   Ú__doc__r   r3   r6   r:   r<   r>   rB   r)   r   r   r+   r+   A   s*   „ ñò:ó*ó*ò$òòór   r+   c                   óX   — e Zd ZdZdd„Zed„ «       Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zy)ÚUploadInputManageraJ  Base manager class for handling various types of files for uploads

    This class is typically used for the UploadSubmissionTask class to help
    determine the following:

        * How to determine the size of the file
        * How to determine if a multipart upload is required
        * How to retrieve the body for a PutObject
        * How to retrieve the bodies for a set of UploadParts

    The answers/implementations differ for the various types of file inputs
    that may be accepted. All implementations must subclass and override
    public methods from this class.
    Nc                 ó.   — || _         || _        || _        y r   )Ú_osutilr.   Ú_bandwidth_limiter)r   Úosutilr0   Úbandwidth_limiters       r   r   zUploadInputManager.__init__}   s   € ØˆŒØ%9ˆÔ"Ø"3ˆÕr   c                 ó   — t        d«      ‚)a  Determines if the source for the upload is compatible with manager

        :param upload_source: The source for which the upload will pull data
            from.

        :returns: True if the manager can handle the type of source specified
            otherwise returns False.
        zmust implement _is_compatible()©ÚNotImplementedError©ÚclsÚupload_sources     r   Úis_compatiblez UploadInputManager.is_compatible‚   s   € ô "Ð"CÓDÐDr   c                 ó   — t        d«      ‚)aÛ  Whether the body it provides are stored in-memory

        :type operation_name: str
        :param operation_name: The name of the client operation that the body
            is being used for. Valid operation_names are ``put_object`` and
            ``upload_part``.

        :rtype: boolean
        :returns: True if the body returned by the manager will be stored in
            memory. False if the manager will not directly store the body in
            memory.
        z%must implement store_body_in_memory()rL   ©r   Úoperation_names     r   Ústores_body_in_memoryz(UploadInputManager.stores_body_in_memoryŽ   s   € ô "Ð"IÓJÐJr   c                 ó   — t        d«      ‚)z¼Provides the transfer size of an upload

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The future associated with upload request
        z&must implement provide_transfer_size()rL   ©r   Útransfer_futures     r   Úprovide_transfer_sizez(UploadInputManager.provide_transfer_size�   s   € ô "Ð"JÓKÐKr   c                 ó   — t        d«      ‚)aÔ  Determines where a multipart upload is required

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The future associated with upload request

        :type config: s3transfer.manager.TransferConfig
        :param config: The config associated to the transfer manager

        :rtype: boolean
        :returns: True, if the upload should be multipart based on
            configuration and size. False, otherwise.
        z*must implement requires_multipart_upload()rL   ©r   rX   Úconfigs      r   Úrequires_multipart_uploadz,UploadInputManager.requires_multipart_upload¥   s   € ô "Ð"NÓOÐOr   c                 ó   — t        d«      ‚)aÜ  Returns the body to use for PutObject

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The future associated with upload request

        :type config: s3transfer.manager.TransferConfig
        :param config: The config associated to the transfer manager

        :rtype: s3transfer.utils.ReadFileChunk
        :returns: A ReadFileChunk including all progress callbacks
            associated with the transfer future.
        z$must implement get_put_object_body()rL   rW   s     r   Úget_put_object_bodyz&UploadInputManager.get_put_object_body´   s   € ô "Ð"HÓIÐIr   c                 ó   — t        d«      ‚)a  Yields the part number and body to use for each UploadPart

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The future associated with upload request

        :type chunksize: int
        :param chunksize: The chunksize to use for this upload.

        :rtype: int, s3transfer.utils.ReadFileChunk
        :returns: Yields the part number and the ReadFileChunk including all
            progress callbacks associated with the transfer future for that
            specific yielded part.
        z)must implement yield_upload_part_bodies()rL   )r   rX   Ú	chunksizes      r   Úyield_upload_part_bodiesz+UploadInputManager.yield_upload_part_bodiesÃ   s   € ô "Ð"MÓNÐNr   c                 óš   — t        || j                  «      }| j                  r(| j                  j                  || j                  d¬«      }|S )NF)Úenabled)r+   r.   rH   Úget_bandwith_limited_stream)r   r/   s     r   Ú_wrap_fileobjz UploadInputManager._wrap_fileobjÓ   sM   € Ü! '¨4×+EÑ+EÓFˆØ×"Ò"Ø×-Ñ-×IÑIØ˜×3Ñ3¸Uð Jó ˆGð ˆr   c                 ó:   — t        |d«      }|rt        |«      gS g S )NÚprogress)r   r   )r   rX   r   s      r   Ú_get_progress_callbacksz*UploadInputManager._get_progress_callbacksÛ   s&   € Ü! /°:Ó>ˆ	ñ Ü.¨yÓ9Ð:Ð:Øˆ	r   c                 ó@   — |D �cg c]  }|j                   ‘Œ c}S c c}w r   )r#   )r   Úaggregated_progress_callbacksr%   s      r   Ú_get_close_callbacksz'UploadInputManager._get_close_callbacksä   s   € Ø/LÖM 8�—“ÒMÐMùÒMs   …r   )r&   r'   r(   rC   r   ÚclassmethodrQ   rU   rY   r]   r_   rb   rf   ri   rl   r)   r   r   rE   rE   m   sP   „ ñó4ð
 ñ	Eó ð	EòKòLòPòJòOò òóNr   rE   c                   óV   — e Zd ZdZed„ «       Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zy)ÚUploadFilenameInputManagerzUpload utility for filenamesc                 ó"   — t        |t        «      S r   )Ú
isinstanceÚstrrN   s     r   rQ   z(UploadFilenameInputManager.is_compatibleë   s   € ä˜-¬Ó-Ð-r   c                  ó   — y)NFr)   rS   s     r   rU   z0UploadFilenameInputManager.stores_body_in_memoryï   s   € Ør   c                 ó¨   — |j                   j                  | j                  j                  |j                   j                  j
                  «      «       y r   )ÚmetarY   rG   Úget_file_sizeÚ	call_argsr/   rW   s     r   rY   z0UploadFilenameInputManager.provide_transfer_sizeò   s:   € Ø×Ñ×2Ñ2Ø�L‰L×&Ñ& ×';Ñ';×'EÑ'E×'MÑ'MÓNõ	
r   c                 óH   — |j                   j                  |j                  k\  S r   )ru   ÚsizeÚmultipart_thresholdr[   s      r   r]   z4UploadFilenameInputManager.requires_multipart_upload÷   s   € Ø×#Ñ#×(Ñ(¨F×,FÑ,FÑFÐFr   c                 óü   — | j                  |«      \  }}| j                  |«      }| j                  |«      }| j                  |«      }|j                  j
                  }| j                  j                  |||||¬«      S )N©r/   Ú
chunk_sizeÚfull_file_sizer   Úclose_callbacks)Ú&_get_put_object_fileobj_with_full_sizerf   ri   rl   ru   ry   rG   Ú#open_file_chunk_reader_from_fileobj)r   rX   r/   Ú	full_sizer   r   ry   s          r   r_   z.UploadFilenameInputManager.get_put_object_bodyú   s‹   € à!×HÑHØó
Ñˆ�ð ×$Ñ$ WÓ-ˆà×0Ñ0°ÓAˆ	Ø×3Ñ3°IÓ>ˆØ×#Ñ#×(Ñ(ˆð �|‰|×?Ñ?ØØØ$ØØ+ð @ó 
ð 	
r   c              #   ó²  K  — |j                   j                  }| j                  ||«      }t        d|dz   «      D ]™  }| j	                  |«      }| j                  |«      }||dz
  z  }| j                  |j                   j                  j                  |||¬«      \  }	}
| j                  |	«      }	| j                  j                  |	||
||¬«      }||f–— Œ› y ­w)Né   )Ú
start_byteÚ	part_sizer~   r|   )ru   ry   Ú_get_num_partsÚrangeri   rl   Ú'_get_upload_part_fileobj_with_full_sizerw   r/   rf   rG   r�   )r   rX   ra   r~   Ú	num_partsÚpart_numberr   r   r…   r/   r‚   Úread_file_chunks               r   rb   z3UploadFilenameInputManager.yield_upload_part_bodies  sö   è ø€ Ø(×-Ñ-×2Ñ2ˆØ×'Ñ'¨¸ÓCˆ	Ü   I°¡MÓ2ò 	/ˆKØ×4Ñ4°_ÓEˆIØ"×7Ñ7¸	ÓBˆOØ" k°A¡oÑ6ˆJð "&×!MÑ!MØ×$Ñ$×.Ñ.×6Ñ6Ø%Ø#Ø-ð	 "Nó "ÑˆG�Yð ×(Ñ(¨Ó1ˆGð #Ÿl™l×NÑNØØ$Ø(Ø#Ø /ð Oó ˆOð ˜Ð.Ó.ñ5	/ùs   ‚CCc                 óJ   — t        ||| j                  j                  ¬«      }|S )N)Úopen_function)r   rG   Úopen)r   r/   r…   s      r   Ú_get_deferred_open_filez2UploadFilenameInputManager._get_deferred_open_file1  s$   € Ü"Ø�Z¨t¯|©|×/@Ñ/@ô
ˆð ˆr   c                 ó–   — |j                   j                  j                  }|j                   j                  }| j	                  |d«      |fS )Nr   )ru   rw   r/   ry   r�   ©r   rX   r/   ry   s       r   r€   zAUploadFilenameInputManager._get_put_object_fileobj_with_full_size7  sB   € Ø!×&Ñ&×0Ñ0×8Ñ8ˆØ×#Ñ#×(Ñ(ˆØ×+Ñ+¨G°QÓ7¸Ð=Ð=r   c                 ó>   — |d   }|d   }| j                  ||«      |fS )Nr…   r~   )r�   )r   r/   rA   r…   r‚   s        r   r‰   zBUploadFilenameInputManager._get_upload_part_fileobj_with_full_size<  s/   € Ø˜LÑ)ˆ
ØÐ+Ñ,ˆ	Ø×+Ñ+¨G°ZÓ@À)ÐKÐKr   c                 ó~   — t        t        j                  |j                  j                  t        |«      z  «      «      S r   )ÚintÚmathÚceilru   ry   Úfloat)r   rX   r†   s      r   r‡   z)UploadFilenameInputManager._get_num_partsA  s,   € Ü”4—9‘9˜_×1Ñ1×6Ñ6¼¸yÓ9IÑIÓJÓKÐKr   N)r&   r'   r(   rC   rm   rQ   rU   rY   r]   r_   rb   r�   r€   r‰   r‡   r)   r   r   ro   ro   è   sG   „ Ù&àñ.ó ð.òò
ò
Gò
ò0/ò>ò>ò
Ló
Lr   ro   c                   ó8   — e Zd ZdZed„ «       Zd„ Zd„ Zd„ Zd„ Z	y)ÚUploadSeekableInputManagerz&Upload utility for an open file objectc                 ó2   — t        |«      xr t        |«      S r   r   rN   s     r   rQ   z(UploadSeekableInputManager.is_compatibleH  s   € ä˜Ó&ÒB¬8°MÓ+BÐBr   c                 ó   — |dk(  ryy)NÚ
put_objectFTr)   rS   s     r   rU   z0UploadSeekableInputManager.stores_body_in_memoryL  s   € Ø˜\Ò)Øàr   c                 ó  — |j                   j                  j                  }|j                  «       }|j	                  dd«       |j                  «       }|j	                  |«       |j                   j                  ||z
  «       y )Nr   é   )ru   rw   r/   r:   r6   rY   )r   rX   r/   Ústart_positionÚend_positions        r   rY   z0UploadSeekableInputManager.provide_transfer_sizeR  sg   € Ø!×&Ñ&×0Ñ0×8Ñ8ˆð !Ÿ™›ˆØ�‰�Q˜ÔØ—|‘|“~ˆØ�‰�^Ô$Ø×Ñ×2Ñ2Ø˜>Ñ)õ	
r   c                 óV   — |j                  |d   «      }t        |«      t        |«      fS )Nr†   )r3   r   Úlen)r   r/   rA   Údatas       r   r‰   zBUploadSeekableInputManager._get_upload_part_fileobj_with_full_size_  s,   € ð �|‰|˜F ;Ñ/Ó0ˆô �t‹}œc $›iÐ'Ð'r   c                 ó˜   — |j                   j                  j                  }|j                  «       |j                   j                  z   }||fS r   )ru   rw   r/   r:   ry   r’   s       r   r€   zAUploadSeekableInputManager._get_put_object_fileobj_with_full_sizen  sA   € Ø!×&Ñ&×0Ñ0×8Ñ8ˆð �|‰|‹~ × 4Ñ 4× 9Ñ 9Ñ9ˆØ˜ˆ}Ðr   N)
r&   r'   r(   rC   rm   rQ   rU   rY   r‰   r€   r)   r   r   rš   rš   E  s-   „ Ù0àñCó ðCòò
ò(ór   rš   c                   ó`   ‡ — e Zd ZdZdˆ fd„	Zed„ «       Zd„ Zd„ Zd„ Z	d„ Z
d„ Zdd	„Zd
„ Zˆ xZS )ÚUploadNonSeekableInputManagerz7Upload utility for a file-like object that cannot seek.c                 ó6   •— t         ‰| �  |||«       d| _        y )Nr   )Úsuperr   Ú_initial_data)r   rI   r0   rJ   Ú	__class__s       €r   r   z&UploadNonSeekableInputManager.__init__y  s   ø€ Ü‰Ñ˜Ð!5Ð7HÔIØ ˆÕr   c                 ó   — t        |«      S r   )r   rN   s     r   rQ   z+UploadNonSeekableInputManager.is_compatible}  s   € ä˜Ó&Ð&r   c                  ó   — y)NTr)   rS   s     r   rU   z3UploadNonSeekableInputManager.stores_body_in_memory�  s   € Ør   c                  ó   — y r   r)   rW   s     r   rY   z3UploadNonSeekableInputManager.provide_transfer_size„  s   € ð 	r   c                 ó0  — |j                   j                  �#|j                   j                  |j                  k\  S |j                   j                  j                  }|j                  }| j                  ||d«      | _        t        | j                  «      |k  ryy)NFT)ru   ry   rz   rw   r/   Ú_readrª   r£   )r   rX   r\   r/   r   s        r   r]   z7UploadNonSeekableInputManager.requires_multipart_upload‰  sƒ   € à×Ñ×$Ñ$Ð0Ø"×'Ñ'×,Ñ,°×0JÑ0JÑJÐJð "×&Ñ&×0Ñ0×8Ñ8ˆØ×.Ñ.ˆ	Ø!ŸZ™Z¨°¸EÓBˆÔÜˆt×!Ñ!Ó" YÒ.Øàr   c                 óô   — | j                  |«      }| j                  |«      }|j                  j                  j                  }| j                  | j                  |j                  «       z   ||«      }d | _        |S r   )ri   rl   ru   rw   r/   Ú
_wrap_datarª   r3   )r   rX   r   r   r/   Úbodys         r   r_   z1UploadNonSeekableInputManager.get_put_object_bodyš  sn   € Ø×0Ñ0°ÓAˆ	Ø×3Ñ3°IÓ>ˆØ!×&Ñ&×0Ñ0×8Ñ8ˆà�‰Ø×Ñ §¡£Ñ/°¸Oó
ˆð "ˆÔØˆr   c              #   ó   K  — |j                   j                  j                  }d}	 | j                  |«      }| j	                  |«      }|dz  }| j                  ||«      }|sy | j                  |||«      }d }||f–— ŒX­w)Nr   r„   )ru   rw   r/   ri   rl   r°   r²   )	r   rX   ra   Úfile_objectr‹   r   r   Úpart_contentÚpart_objects	            r   rb   z6UploadNonSeekableInputManager.yield_upload_part_bodies¨  s“   è ø€ Ø%×*Ñ*×4Ñ4×<Ñ<ˆØˆð Ø×4Ñ4°_ÓEˆIØ"×7Ñ7¸	ÓBˆOØ˜1ÑˆKØŸ:™: k°9Ó=ˆLÙØØŸ/™/Ø˜i¨óˆKð
  ˆLØ˜{Ð*Ò*ð ùs   ‚A<A>c                 óT  — t        | j                  «      dk(  r|j                  |«      S |t        | j                  «      k  r'| j                  d| }|r| j                  |d | _        |S |t        | j                  «      z
  }| j                  |j                  |«      z   }|rd| _        |S )a=  
        Reads a specific amount of data from a stream and returns it. If there
        is any data in initial_data, that will be popped out first.

        :type fileobj: A file-like object that implements read
        :param fileobj: The stream to read from.

        :type amount: int
        :param amount: The number of bytes to read from the stream.

        :type truncate: bool
        :param truncate: Whether or not to truncate initial_data after
            reading from it.

        :return: Generator which generates part bodies from the initial data.
        r   Nr   )r£   rª   r3   )r   r/   r4   Útruncater¤   Úamount_to_reads         r   r°   z#UploadNonSeekableInputManager._read¼  s®   € ô$ ˆt×!Ñ!Ó" aÒ'Ø—<‘< Ó'Ð'ð ”S˜×+Ñ+Ó,Ò,Ø×%Ñ% g vÐ.ˆDñ Ø%)×%7Ñ%7¸¸Ð%@�Ô"ØˆKð
  ¤# d×&8Ñ&8Ó"9Ñ9ˆØ×!Ñ! G§L¡L°Ó$@Ñ@ˆñ Ø!$ˆDÔØˆr   c                 óš   — | j                  t        |«      «      }| j                  j                  |t	        |«      t	        |«      ||¬«      S )a¸  
        Wraps data with the interrupt reader and the file chunk reader.

        :type data: bytes
        :param data: The data to wrap.

        :type callbacks: list
        :param callbacks: The callbacks associated with the transfer future.

        :type close_callbacks: list
        :param close_callbacks: The callbacks to be called when closing the
            wrapper for the data.

        :return: Fully wrapped data.
        r|   )rf   r   rG   r�   r£   )r   r¤   r   r   r/   s        r   r²   z(UploadNonSeekableInputManager._wrap_dataæ  sL   € ð  ×$Ñ$¤W¨T£]Ó3ˆØ�|‰|×?Ñ?ØÜ˜4“yÜ˜t›9ØØ+ð @ó 
ð 	
r   r   )T)r&   r'   r(   rC   r   rm   rQ   rU   rY   r]   r_   rb   r°   r²   Ú__classcell__)r«   s   @r   r§   r§   v  sC   ø„ ÙAõ!ð ñ'ó ð'òòò
ò"ò+ó((öT
r   r§   c                   óN   — e Zd ZdZg d¢Zg d¢Zd„ Z	 dd„Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zy)ÚUploadSubmissionTaskz.Task for submitting tasks to execute an upload)ÚChecksumAlgorithmÚSSECustomerKeyÚSSECustomerAlgorithmÚSSECustomerKeyMD5ÚRequestPayerÚExpectedBucketOwner)rÀ   rÁ   rÂ   rÃ   rÄ   c                 óä   — t         t        t        g}|j                  j                  j
                  }|D ]  }|j                  |«      sŒ|c S  t        dj                  |t        |«      «      «      ‚)ao  Retrieves a class for managing input for an upload based on file type

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The transfer future for the request

        :rtype: class of UploadInputManager
        :returns: The appropriate class to use for managing a specific type of
            input for uploads.
        z&Input {} of type: {} is not supported.)
ro   rš   r§   ru   rw   r/   rQ   ÚRuntimeErrorÚformatÚtype)r   rX   Úupload_manager_resolver_chainr/   Úupload_manager_clss        r   Ú_get_upload_input_manager_clsz2UploadSubmissionTask._get_upload_input_manager_cls  sx   € ô 'Ü&Ü)ð)
Ð%ð "×&Ñ&×0Ñ0×8Ñ8ˆØ"?ò 	*ÐØ!×/Ñ/°Õ8Ø)Ò)ð	*ô Ø4×;Ñ;Øœ˜g›óó
ð 	
r   Nc                 ó  —  | j                  |«      || j                  |«      }|j                  j                  €|j	                  |«       |j                  ||«      s| 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)rË   r.   ru   ry   rY   r]   Ú_submit_upload_requestÚ_submit_multipart_request)r   Úclientr\   rI   Úrequest_executorrX   rJ   Úupload_input_managers           r   Ú_submitzUploadSubmissionTask._submit.  s©   € ð6 
˜t×AÑAØó 
à
�$×,Ñ,Ð.?ó AÐð
 ×Ñ×$Ñ$Ð,Ø ×6Ñ6°ÔGð $×=Ñ=Ø˜Vô
ð ×'Ñ'ØØØØ ØØ$õð ×*Ñ*ØØØØ ØØ$õr   c                 ó"  — |j                   j                  }| j                  |d«      }| j                  j	                  |t        | j                  ||j                  |«      |j                  |j                  |j                  dœd¬«      |¬«       y )Nr�   )rÏ   r/   ÚbucketÚkeyÚ
extra_argsT)r0   Úmain_kwargsÚis_final©Útag)
ru   rw   Ú_get_upload_task_tagr.   ÚsubmitÚPutObjectTaskr_   rÔ   rÕ   rÖ   )	r   rÏ   r\   rI   rÐ   rX   rÑ   rw   Úput_object_tags	            r   rÍ   z+UploadSubmissionTask._submit_upload_requestg  s™   € ð $×(Ñ(×2Ñ2ˆ	ð ×2Ñ2Ø  ,ó
ˆð
 	×"Ñ"×)Ñ)ØÜØ%)×%?Ñ%?à$Ø3×GÑGØ'ó ð (×.Ñ.Ø$Ÿ=™=Ø"+×"6Ñ"6ñð ôð ð 	*õ 	
r   c                 óz  — |j                   j                  }| j                  j                  |t	        | j                  ||j
                  |j                  |j                  dœ¬«      «      }g }	| j                  |j                  «      }
| j                  |d«      }|j                   j                  }t        «       }|j                  |j                  |«      }|j                  ||«      }|D ]e  \  }}|	j                  | j                  j                  |t!        | j                  |||j
                  |j                  ||
dœd|i¬«      |¬«      «       Œg | j#                  |j                  «      }| j                  j                  |t%        | j                  ||j
                  |j                  |dœ||	dœd	¬
«      «       y )N)rÏ   rÔ   rÕ   rÖ   )r0   r×   Úupload_part)rÏ   r/   rÔ   rÕ   r‹   rÖ   Ú	upload_id)r0   r×   Úpending_main_kwargsrÙ   )rá   ÚpartsT)r0   r×   râ   rØ   )ru   rw   r.   rÜ   r	   rÔ   rÕ   rÖ   Ú_extra_upload_part_argsrÛ   ry   r   Úadjust_chunksizeÚmultipart_chunksizerb   ÚappendÚUploadPartTaskÚ_extra_complete_multipart_argsr   )r   rÏ   r\   rI   rÐ   rX   rÑ   rw   Úcreate_multipart_futureÚpart_futuresÚextra_part_argsÚupload_part_tagry   Úadjusterra   Úpart_iteratorr‹   r/   Úcomplete_multipart_extra_argss                      r   rÎ   z.UploadSubmissionTask._submit_multipart_requestŠ  sÖ  € ð $×(Ñ(×2Ñ2ˆ	ð #'×"<Ñ"<×"CÑ"CØÜ%Ø%)×%?Ñ%?à$Ø'×.Ñ.Ø$Ÿ=™=Ø"+×"6Ñ"6ñ	ôó#
Ðð ˆØ×6Ñ6°y×7KÑ7KÓLˆð ×3Ñ3Ø  -ó
ˆð ×#Ñ#×(Ñ(ˆÜ$Ó&ˆØ×-Ñ-¨f×.HÑ.HÈ$ÓOˆ	Ø,×EÑEØ˜Yó
ˆð %2ò 	Ñ ˆK˜Ø×ÑØ×*Ñ*×1Ñ1Ø$Ü"Ø-1×-GÑ-Gà&,Ø'.Ø&/×&6Ñ&6Ø#,§=¡=Ø+6Ø*9ñ%ð (Ð)@ð-ôð (ð! 2ó õð	ð, )-×(KÑ(KØ× Ñ ó)
Ð%ð 	×"Ñ"×)Ñ)ØÜ'Ø%)×%?Ñ%?à$Ø'×.Ñ.Ø$Ÿ=™=Ø"?ñ	ð "9Ø)ñ%ð ôõ	
r   c                 ó.   — t        || j                  «      S r   )r   ÚUPLOAD_PART_ARGS©r   rÖ   s     r   rä   z,UploadSubmissionTask._extra_upload_part_argsà  s   € ô ! ¨T×-BÑ-BÓCÐCr   c                 ó.   — t        || j                  «      S r   )r   ÚCOMPLETE_MULTIPART_ARGSró   s     r   ré   z3UploadSubmissionTask._extra_complete_multipart_argså  s   € Ü  ¨T×-IÑ-IÓJÐJr   c                 ó8   — d }|j                  |«      rt        }|S r   )rU   r   )r   rÑ   rT   rÚ   s       r   rÛ   z)UploadSubmissionTask._get_upload_task_tagè  s   € ØˆØ×5Ñ5°nÔEÜ&ˆCØˆ
r   r   )r&   r'   r(   rC   rò   rõ   rË   rÒ   rÍ   rÎ   rä   ré   rÛ   r)   r   r   r¾   r¾      sD   „ Ù8òÐòÐò
ðB ó7òr!
òFT
òlDò
Kór   r¾   c                   ó   — e Zd ZdZd„ Zy)rÝ   z Task to do a nonmultipart uploadc                 ó^   — |5 } |j                   d|||dœ|¤Ž ddd«       y# 1 sw Y   yxY w)aP  
        :param client: The client to use when calling PutObject
        :param fileobj: The file to upload.
        :param bucket: The name of the bucket to upload to
        :param key: The name of the key to upload to
        :param extra_args: A dictionary of any extra arguments that may be
            used in the upload.
        )ÚBucketÚKeyÚBodyNr)   )r�   )r   rÏ   r/   rÔ   rÕ   rÖ   r³   s          r   Ú_mainzPutObjectTask._mainò  s>   € ð ð 	O˜ØˆF×ÑÐN V°¸4ÑNÀ:ÒN÷	O÷ 	Oñ 	Oús   ƒ#£,N©r&   r'   r(   rC   rü   r)   r   r   rÝ   rÝ   ï  s   „ Ù*ó
Or   rÝ   c                   ó   — e Zd ZdZd„ Zy)rè   z+Task to upload a part in a multipart uploadc           
      óÈ   — |5 } |j                   d|||||dœ|¤Ž}	ddd«       	d   }
|
|dœ}d|v r$|d   j                  «       }d|› �}||	v r|	|   ||<   |S # 1 sw Y   Œ=xY w)aÓ  
        :param client: The client to use when calling PutObject
        :param fileobj: The file to upload.
        :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.

        :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.
        )rù   rú   ÚUploadIdÚ
PartNumberrû   NÚETag)r  r  r¿   ÚChecksumr)   )rà   Úupper)r   rÏ   r/   rÔ   rÕ   rá   r‹   rÖ   r³   ÚresponseÚetagÚpart_metadataÚalgorithm_nameÚchecksum_members                 r   rü   zUploadPartTask._main  sª   € ð, ð 	˜Ø)�v×)Ñ)ð ØØØ"Ø&Øñð ñˆH÷	ð ˜ÑˆØ!%°[ÑAˆØ *Ñ,Ø'Ð(;Ñ<×BÑBÓDˆNØ (¨Ð(8Ð9ˆOØ (Ñ*Ø19¸/Ñ1J�˜oÑ.ØÐ÷!	ð 	ús   ƒAÁA!Nrý   r)   r   r   rè   rè   ÿ  s
   „ Ù5ó&r   rè   )r–   Úior   Ús3transfer.compatr   r   Ús3transfer.futuresr   Ús3transfer.tasksr   r	   r
   r   Ús3transfer.utilsr   r   r   r   r   r+   rE   ro   rš   r§   r¾   rÝ   rè   r)   r   r   ú<module>r     s¥   ðó Ý ç 0Ý 3÷ó ÷ó ÷ñ ÷B)ñ )÷XxNñ xNôvZLÐ!3ô ZLôz.Ð!;ô .ôbG
Ð$6ô G
ôTl˜>ô lô^O�Dô Oô )�Tõ )r   