Current File : //proc/353637/cwd/usr/lib/python3/dist-packages/s3transfer/__pycache__/crt.cpython-312.pyc
�

�<�e�y��@�ddlZddlZddlmZddlZddlZddlZddl	Zddl
mZmZm
Z
mZddlmZmZmZmZmZddlmZmZmZddlmZddlmZddlmZdd	lmZdd
lm Z ddl!m"Z"ddl#m$Z$m%Z%dd
l&m'Z'm(Z(m)Z)m*Z*ejVe,�Z-da.d�Z/dddde zddfd�Z0d+d�Z1Gd�d�Z2Gd�de%�Z3Gd�de$�Z4Gd�d�Z5Gd�de5�Z6Gd�de�Z7Gd�d �Z8Gd!�d"�Z9Gd#�d$�Z:Gd%�d&�Z;Gd'�d(�Z<Gd)�d*�Z=y),�N)�BytesIO)�AwsCredentials�AwsCredentialsProvider�AwsSigningAlgorithm�AwsSigningConfig)�ClientBootstrap�ClientTlsContext�DefaultHostResolver�EventLoopGroup�TlsContextOptions)�S3Client�S3RequestTlsMode�
S3RequestType)�UNSIGNED)�urlsplit)�Config)�NoCredentialsError)�MB)�TransferNotDoneError)�BaseTransferFuture�BaseTransferMeta)�CallArgs�OSUtils�
get_callbacks�is_s3express_bucketc��t�2tjj|�}	|j	�|atS#t
$rYywxYw�N)�CRT_S3_PROCESS_LOCK�awscrt�s3�CrossProcessLock�acquire�RuntimeError)�name�crt_locks  �0/usr/lib/python3/dist-packages/s3transfer/crt.py�acquire_crt_s3_process_lockr'7sS���"��9�9�-�-�d�3��	�����'�����
�	��		�s�?�	A�
A�Tc
�R�t|�}t|�}t||�}	d}
|rtjntj
}|�At
�}|r|j|��nd|_t|�}
|
j�}
t|��}t|	|||||
|d��S)a�
    :type region: str
    :param region: The region used for signing

    :type crt_credentials_provider:
        Optional[awscrt.auth.AwsCredentialsProvider]
    :param crt_credentials_provider: CRT AWS credentials provider
        to use to sign requests. If not set, requests will not be signed.

    :type num_threads: Optional[int]
    :param num_threads: Number of worker threads generated. Default
        is the number of processors in the machine.

    :type target_throughput: Optional[int]
    :param target_throughput: Throughput target in bytes per second.
        By default, CRT will automatically attempt to choose a target
        throughput that matches the system's maximum network throughput.
        Currently, if CRT is unable to determine the maximum network
        throughput, a fallback target throughput of ``1_250_000_000`` bytes
        per second (which translates to 10 gigabits per second, or 1.16
        gibibytes per second) is used. To set a specific target
        throughput, set a value for this parameter.

    :type part_size: Optional[int]
    :param part_size: Size, in Bytes, of parts that files will be downloaded
        or uploaded in.

    :type use_ssl: boolean
    :param use_ssl: Whether or not to use SSL.  By default, SSL is used.
        Note that not all services support non-ssl connections.

    :type verify: Optional[boolean/string]
    :param verify: Whether or not to verify SSL certificates.
        By default SSL certificates are verified.  You can provide the
        following values:

        * False - do not validate SSL certificates.  SSL will still be
            used (unless use_ssl is False), but SSL certificates
            will not be verified.
        * path/to/cert/bundle.pem - A filename of the CA cert bundle to
            use. Specify this argument if you want to use a custom CA cert
            bundle instead of the default one on your system.
    N)�ca_filepathF)� provided_throughput_target_bytesT)�	bootstrap�region�credential_provider�	part_size�tls_mode�tls_connection_options�throughput_target_gbps�enable_s3express)
rr
rr�ENABLED�DISABLEDr�&override_default_trust_store_from_path�verify_peerr	�new_connection_options�_get_crt_throughput_target_gbpsr
)r-�crt_credentials_provider�num_threads�target_throughputr/�use_ssl�verify�event_loop_group�
host_resolverr,r1r0�tls_ctx_options�client_tls_option�target_gbpss               r&�create_s3_crt_clientrDPs���h&�k�2��'�(8�9�M�� 0�-�@�I�!��%,�� � �1A�1J�1J�
���+�-����B�B�"�
C�
�+0�O�'�,�_�=��!2�!I�!I�!K��1�):��K����4���5�*��	�	�c��|�9tjj�}tj	d|�|�d}n|dzdz}tj	d|�|S)Nz-Recommended CRT throughput target in gbps: %sg$@r(iʚ;z'Using CRT throughput target in gbps: %s)rr �&get_recommended_throughput_target_gbps�logger�debug)r+rCs  r&r9r9�s^��'�/��i�i�F�F�H�����;�[�	
����K�7��:�]�J��
�L�L�:�K�H��rEc�n�eZdZdd�Zd�Zd�Z	dd�Zdd�Zdd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
dd
�Zd�Zd�Zy)�CRTTransferManagerNc���|�t�|_||_t||j�|_|j
|_g|_tjd�|_
d|_y)aFA transfer manager interface for Amazon S3 on CRT s3 client.

        :type crt_s3_client: awscrt.s3.S3Client
        :param crt_s3_client: The CRT s3 client, handling all the
            HTTP requests and functions under then hood

        :type crt_request_serializer: s3transfer.crt.BaseCRTRequestSerializer
        :param crt_request_serializer: Serializer, generates unsigned crt HTTP
            request.

        :type osutil: s3transfer.utils.OSUtils
        :param osutil: OSUtils object to use for os-related behavior when
            using with transfer manager.
        N�r)r�_osutil�_crt_s3_client�S3ClientArgsCreator�_s3_args_creator�translate_crt_exception�_crt_exception_translator�_future_coordinators�	threading�	Semaphore�
_semaphore�_id_counter)�self�
crt_s3_client�crt_request_serializer�osutils    r&�__init__zCRTTransferManager.__init__�sg���>�"�9�D�L�+��� 3�"�D�L�L�!
���
#�:�:�	
�&�%'��!�#�-�-�c�2�����rEc��|Sr��rYs r&�	__enter__zCRTTransferManager.__enter__�s���rEc�2�d}|rd}|j|�y)NFT��	_shutdown)rY�exc_type�	exc_value�args�cancels     r&�__exit__zCRTTransferManager.__exit__�s������F����v�rEc�V�|�i}|�i}t|||||��}|jd|�S)N��bucket�key�fileobj�
extra_args�subscribers�
get_object�r�_submit_transfer)rYrlrmrnrorp�callargss       r&�downloadzCRTTransferManager.download�sH�����J����K�����!�#�
���$�$�\�8�<�<rEc�x�|�i}|�i}|j|�t|||||��}|jd|�S)Nrk�
put_object)�&_validate_checksum_algorithm_supportedrrs)rYrnrlrmrorprts       r&�uploadzCRTTransferManager.upload�sT�����J����K��3�3�J�?�����!�#�
���$�$�\�8�<�<rEc�T�|�i}|�i}t||||��}|jd|�S)N)rlrmrorp�
delete_objectrr)rYrlrmrorprts      r&�deletezCRTTransferManager.delete�sC�����J����K����!�#�	
���$�$�_�h�?�?rEc�&�|j|�yrrc�rYrhs  r&�shutdownzCRTTransferManager.shutdown
s�����v�rEc���|jd�}|�yttjjj
�}|j
�|vrtd|�d|����y)N�ChecksumAlgorithmzChecksumAlgorithm: z* not supported. Supported algorithms are: )�get�listrr �S3ChecksumAlgorithm�__members__�upper�
ValueError)rYro�checksum_algorithm�supported_algorithmss    r&rxz9CRTTransferManager._validate_checksum_algorithm_supported
su��'�^�^�,?�@���%��#�F�I�I�$A�$A�$M�$M�N���#�#�%�-A�A��%�&8�%9�:-�-A�,B�D��
�BrEc�h�|jD]#}|j�r�|j��%yr)rT�donerh�rY�coordinators  r&�_cancel_transfersz$CRTTransferManager._cancel_transferss/���4�4�	%�K��#�#�%��"�"�$�	%rEc�F�|jD]}|j��yr)rT�resultr�s  r&�_finish_transfersz$CRTTransferManager._finish_transferss#���4�4�	!�K���� �	!rEc�F�|jD]}|j��yr)rT�%wait_until_on_done_callbacks_completer�s  r&�_wait_transfers_donez'CRTTransferManager._wait_transfers_done!s%���4�4�	@�K��=�=�?�	@rEc���|r|j�	|j�|j	�y#t$r|j�Y�,t$rY�6wxYw#|j	�wxYwr)r�r��KeyboardInterrupt�	Exceptionr�r~s  r&rdzCRTTransferManager._shutdown%sg����"�"�$�	(��"�"�$�
�%�%�'��!�	%��"�"�$��	��	��
�%�%�'�s-�5�A�A�A�A�A�A�A0c�8�|jj�yr)rW�release�rY�kwargss  r&�_release_semaphorez%CRTTransferManager._release_semaphore2s�������!rEc���|jg}t|j|j��}t	|j|�|d�}td	i|��}t
|�}|j|�	|jj�|jj|d�}|�|jj|||||�}	|jjd	i|	��}
|j|
�|j$j|�|xjdz
c_|S#t $rC}|j#|d�|jj|d|��}||��Yd}~�yd}~wwxYw)
N)�transfer_id�exception_translator)�metar��queuedTr�)�after_subscribers)�error�r_)r��CRTTransferCoordinatorrXrS�CRTTransferMeta�CRTTransferFuture�AfterDoneHandler�appendrWr"rQ�get_crt_callback�get_make_request_argsrO�make_request�set_s3_requestr��
set_exceptionrT)
rY�request_type�	call_args�on_done_after_callsr��
components�future�	afterdone�	on_queued�crt_callargs�crt_s3_request�e�on_dones
             r&rsz#CRTTransferManager._submit_transfer5su��#�6�6�7��,��(�(�!%�!?�!?�
��
$�D�$4�$4�i�@�&�
�
�#�0�Z�0��$�[�1�	��"�"�9�-�	7��O�O�#�#�%��-�-�>�>����I�
�K��0�0�F�F�����#��L�>�T�0�0�=�=�M��M�N�
�&�&�~�6��!�!�(�(��5����A����
���	��%�%�a��.��+�+�<�<���2E�=��G�
�!����	�s�0A8D+�+	E7�49E2�2E7r�NN�F)�__name__�
__module__�__qualname__r]rariruryr|rrxr�r�r�rdr�rsr_rEr&rKrK�sQ���:��BF�=� 
=�@��	�%�
!�@�(�"�'rErKc�H�eZdZdZdd�Zed��Zed��Zed��Zy)r�z*Holds metadata about the CRTTransferFutureNc�.�||_||_i|_yr)�_transfer_id�
_call_args�
_user_context)rYr�r�s   r&r]zCRTTransferMeta.__init__bs��'���#�����rEc��|jSr)r�r`s r&r�zCRTTransferMeta.call_argsgs�����rEc��|jSr)r�r`s r&r�zCRTTransferMeta.transfer_idks��� � � rEc��|jSr)r�r`s r&�user_contextzCRTTransferMeta.user_contextos���!�!�!rEr�)	r�r�r��__doc__r]�propertyr�r�r�r_rEr&r�r�_sF��4� �
�����!��!��"��"rEr�c�>�eZdZdd�Zed��Zd�Zd	d�Zd�Zd�Z	y)
r�Nc�B�||_|�t�|_||_y)aZThe future associated to a submitted transfer request via CRT S3 client

        :type meta: s3transfer.crt.CRTTransferMeta
        :param meta: The metadata associated to the transfer future.

        :type coordinator: s3transfer.crt.CRTTransferCoordinator
        :param coordinator: The coordinator associated to the transfer future.
        N)�_metar��_coordinator)rYr�r�s   r&r]zCRTTransferFuture.__init__us"����
��<�(�*�D�J�'��rEc��|jSr)r�r`s r&r�zCRTTransferFuture.meta�s���z�z�rEc�6�|jj�Sr)r�r�r`s r&r�zCRTTransferFuture.done�s��� � �%�%�'�'rEc�:�|jj|�yr)r�r��rY�timeouts  r&r�zCRTTransferFuture.result�s����� � ��)rEc�8�|jj�yr)r�rhr`s r&rhzCRTTransferFuture.cancel�s����� � �"rEc�t�|j�std��|jj|d��y)z!Sets the exception on the future.z?set_exception can only be called once the transfer is complete.T)�overrideN)r�rr�r��rY�	exceptions  r&r�zCRTTransferFuture.set_exception�s8���y�y�{�&���
�	
���'�'�	�D�'�ArEr�r)
r�r�r�r]r�r�r�r�rhr�r_rEr&r�r�ts0��(�����(�*�#�BrEr�c��eZdZd�Zd�Zy)�BaseCRTRequestSerializerc��td��)alSerialize CRT HTTP requests.

        :type transfer_type: string
        :param transfer_type: the type of transfer made,
            e.g 'put_object', 'get_object', 'delete_object'

        :type future: s3transfer.crt.CRTTransferFuture

        :rtype: awscrt.http.HttpRequest
        :returns: An unsigned HTTP request to be used for the CRT S3 client
        zserialize_http_request()��NotImplementedError)rY�
transfer_typer�s   r&�serialize_http_requestz/BaseCRTRequestSerializer.serialize_http_request�s��"�"<�=�=rEc��td��)Nztranslate_crt_exception()r�r�s  r&rRz0BaseCRTRequestSerializer.translate_crt_exception�s��!�"=�>�>rEN)r�r�r�r�rRr_rEr&r�r��s��>�?rEr�c�P�eZdZd
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
y)�BotocoreCRTRequestSerializerNc���||_|�i}|j||�|jdi|��|_|jjj
j
d|j�|jjj
j
d|j�|jjj
j
d|j�y)a�Serialize CRT HTTP request using botocore logic
        It also takes into account configuration from both the session
        and any keyword arguments that could be passed to
        `Session.create_client()` when serializing the request.

        :type session: botocore.session.Session

        :type client_kwargs: Optional[Dict[str, str]])
        :param client_kwargs: The kwargs for the botocore
            s3 client initialization.
        Nzrequest-created.s3.*zafter-call.s3.*zbefore-send.s3.*r_)
�_session�_resolve_client_config�
create_client�_clientr��events�register�_capture_http_request�+_change_response_to_serialized_http_request�_make_fake_http_response)rY�session�
client_kwargss   r&r]z%BotocoreCRTRequestSerializer.__init__�s��� ��
�� ��M��#�#�G�]�;�,�w�,�,�=�}�=�������� � �)�)�"�D�$>�$>�	
�	
����� � �)�)��t�O�O�	
�	
����� � �)�)��� =� =�	
rEc��d}|j�r|j�}d|vr|d}tt��}|r|j|�}||d<d|d<y)N�config)�signature_versionr �service_name)�get_default_client_configrr�merge)rYr�r��user_provided_config�
client_configs     r&r�z3BotocoreCRTRequestSerializer._resolve_client_config�sg��#���,�,�.�#*�#D�#D�#F� ��}�$�#0��#:� ���:�
��0�6�6�}�E�M�"/�
�h��(,�
�n�%rEc��t|j�}|j}|jr|�d|j��}g}|jj�D]F\}}t
|t�r|j||f��*|j|t|d�f��Htjj|�}tjj|j|||j��}|S)N�?zutf-8)�method�path�headers�body_stream)r�urlr��queryr��items�
isinstance�strr�r�http�HttpHeaders�HttpRequestr��body)	rY�aws_request�	url_parts�crt_path�headers_listr$�value�crt_headers�crt_requests	         r&�_crt_request_from_aws_requestz:BotocoreCRTRequestSerializer._crt_request_from_aws_request�s����[�_�_�-�	��>�>���?�?�"��1�Y�_�_�$5�6�H���&�.�.�4�4�6�	A�K�D�%��%��%��#�#�T�5�M�2��#�#�T�3�u�g�+>�$?�@�		A��k�k�-�-�l�;���k�k�-�-��%�%���#�(�(�	.�
���rEc�2�|j|�}|jjd��;t|j�}|jjd|j�|jjd��|jjd�|jjd��(|j�|jjdd�|jjd��|jjd�|S)N�hostzContent-MD5zContent-Length�0zTransfer-Encoding)
rr�r�rr��set�netloc�remover�add)rY�botocore_http_requestrrs    r&�_convert_to_crt_http_requestz9BotocoreCRTRequestSerializer._convert_to_crt_http_request�s����8�8�9N�O�����"�"�6�*�2� �!6�!:�!:�;�I����#�#�F�I�,<�,<�=����"�"�=�1�=����&�&�}�5����"�"�#3�4�<�$�)�)�1��#�#�'�'�(8�#�>����"�"�#6�7�C����&�&�':�;��rEc�"�||jd<y)N�http_request)�context�rY�requestr�s   r&r�z2BotocoreCRTRequestSerializer._capture_http_request
s��*1�����'rEc�4�|d}|j�|d<y)Nr�HTTPRequest)�prepare)rYr�parsedr�rs     r&r�zHBotocoreCRTRequestSerializer._change_response_to_serialized_http_request
s���.�)�� '��� 1��}�rEc�X�tjjdditd��S)N��rE)�botocore�
awsrequest�AWSResponse�FakeRawResponsers   r&r�z5BotocoreCRTRequestSerializer._make_fake_http_responses,���"�"�.�.�����C� �	
�	
rEc��t|j|�d|j|jd�|j��dS)N)�Bucket�Keyrr_)�getattrr�rlrmro)rY�
client_methodr�s   r&�_get_botocore_http_requestz7BotocoreCRTRequestSerializer._get_botocore_http_requestsF��3�w�t�|�|�]�3�
��#�#����
�:C�:N�:N�
�
��	rEc�t�|j||jj�}|j|�}|Sr)r*r�r�r)rYr�r�rrs     r&r�z3BotocoreCRTRequestSerializer.serialize_http_request s;�� $� ?� ?��6�;�;�0�0�!
���7�7�8M�N���rEc�n�t|tjj�r|j	|�Syr)r�rr �S3ResponseError� _translate_crt_s3_response_errorr�s  r&rRz4BotocoreCRTRequestSerializer.translate_crt_exception's*���i����!:�!:�;��8�8��C�C�rEc�P�|j}|dkry|jD��cic]\}}||��
}}}|j}|�<|jjj
}|j
|�j}nd}tjj|�||jd�}	|jjj|	|��}
|
jdi�jd�}|jjj!|�}||
|��Scc}}w)Ni-)r��status_coder)�shape�Error�Code)�operation_name)r0r�r4r�r��
service_model�operation_model�output_shaper!r"�HeadersDictr�_response_parser�parser��
exceptions�	from_code)
rY�s3_response_errorr0�k�vr�r4r5r1�
response_dict�parsed_response�
error_code�error_classs
             r&r.z=BotocoreCRTRequestSerializer._translate_crt_s3_response_error-s��'�3�3������$5�$=�$=�>�D�A�q�1�a�4�>��>�*�9�9���%� �L�L�-�-�;�;�M�!�1�1�.�A�N�N�E��E� �*�*�6�6�w�?�&�%�*�*�
�
�
�,�,�7�7�=�=���>�
��%�(�(��"�5�9�9�&�A�
��l�l�-�-�7�7�
�C���?�>�J�J��'?s�
D"r)r�r�r�r]r�rrr�r�r�r*r�rRr.r_rEr&r�r��s:��
�6-��,�<2�2�
��
��KrEr�c��eZdZdd�Zy)r$Nc#�>K�	|j|�}|sy|����wr)�read)rY�amt�decode_content�chunks    r&�streamzFakeRawResponse.streamKs&������I�I�c�N�E����K�	�s�)iN)r�r�r�rJr_rEr&r$r$Js��rEr$c�$�eZdZd�Zd�Zd�Zd�Zy)�BotocoreCRTCredentialsWrapperc��||_yr)�_resolved_credentials)rY�resolved_botocore_credentialss  r&r]z&BotocoreCRTCredentialsWrapper.__init__Ts
��%B��"rEc��|j�j�}t|j|j|j
�Sr)�_get_credentials�get_frozen_credentialsr�
access_key�
secret_key�token)rY�credentialss  r&�__call__z&BotocoreCRTCredentialsWrapper.__call__Ws?���+�+�-�D�D�F����"�"�K�$:�$:�K�<M�<M�
�	
rEc�,�tj|�Sr)r�new_delegater`s r&�to_crt_credentials_providerz9BotocoreCRTCredentialsWrapper.to_crt_credentials_provider]s��%�2�2�4�8�8rEc�F�|j�
t��|jSr)rNrr`s r&rQz.BotocoreCRTCredentialsWrapper._get_credentials`s#���%�%�-�$�&�&��)�)�)rEN)r�r�r�r]rWrZrQr_rEr&rLrLSs��C�
�9�*rErLc�`�eZdZdZ	d
d�Zed��Zd�Zdd�Zdd�Z	d�Z
dd	�Zd
�Zd�Z
d�Zy)r�z-A helper class for managing CRTTransferFutureNc��||_||_||_tj�|_d|_d|_tj�|_	yr)
r��_exception_translator�_s3_requestrU�Lock�_lock�
_exception�_crt_future�Event�_done_event)rYr��
s3_requestr�s    r&r]zCRTTransferCoordinator.__init__isH��'���%9��"�%����^�^�%��
�������$�?�?�,��rEc��|jSr)r_r`s r&rfz!CRTTransferCoordinator.s3_requestts�����rEc�8�|jj�yr)rerr`s r&�set_done_callbacks_completez2CRTTransferCoordinator.set_done_callbacks_completexs�������rEc�:�|jj|�yr)re�waitr�s  r&r�z<CRTTransferCoordinator.wait_until_on_done_callbacks_complete{s�������g�&rEc�x�|j5|j�r|r||_ddd�y#1swYyxYwr)rar�rb)rYr�r�s   r&r�z$CRTTransferCoordinator.set_exception~s0��
�Z�Z�	,��9�9�;�(�"+���	,�	,�	,�s�0�9c�R�|jr|jj�yyr)r_rhr`s r&rhzCRTTransferCoordinator.cancel�s"��������#�#�%�rEc�|�|jr|j�	|jj|�|jrd|_yy#t$r-|j	�|jj|��t
$r}|j
|�Yd}~�hd}~wwxYw#|jrd|_wwxYwr)rbrcr�r�rhr��handle_exceptionr_)rYr�r�s   r&r�zCRTTransferCoordinator.result�s����?�?��/�/�!�
	(����#�#�G�,����#'�� � ��!�	��K�K�M����#�#�G�,���	%��!�!�!�$�$��	%�����#'�� � �s)�A
�
=B"�B�B%�B"�"B%�%B;c��d}|jr	|j|�}|�||�|�#t$r!}tjd|��Yd}~�,d}~wwxYw)NzUnable to translate exception.)�exc_info)r^r�rHrI)rY�exc�translated_excr�s    r&roz'CRTTransferCoordinator.handle_exception�sb�����%�%�
�!%�!;�!;�C�!@���%� �c�)��I���
����=���J���	
�s�(�	A�A
�
Ac�P�|j�y|jj�S)NF)rcr�r`s r&r�zCRTTransferCoordinator.done�s&�����#�����$�$�&�&rEc�H�||_|jj|_yr)r_�finished_futurerc)rYrfs  r&r�z%CRTTransferCoordinator.set_s3_request�s��%����+�+�;�;��rE)NNNrr�)r�r�r�r�r]r�rfrir�r�rhr�ror�r�r_rEr&r�r�fsM��7�GK�	-�� �� ��'�,�
&�
(�
�'�
<rEr�c�6�eZdZd�Zd�Z		dd�Zd�Zd�Zd�Zy)	rPc� �||_||_yr)�_request_serializer�	_os_utils)rYr[�os_utilss   r&r]zS3ClientArgsCreator.__init__�s��#9�� �!��rEc�R�t|d|��|j�}|||||g|��S)N�_get_make_request_args_�r�r�r�r��on_done_before_callsr�)r(�_default_get_make_request_args)rYr�r�r�r�r��request_args_handlers       r&r�z)S3ClientArgsCreator.get_make_request_args�sF�� '��%�l�^�4��/�/� 
��
$�%��#��!#� 3�

�	
rENc����������fd�}|S)Nc���g}��|�z
}|t���z
}��|�z
}|D]}�dk(r
||d���||i|���y)N�progressr)�bytes_transferred)r)rgr��callbacks_list�callbackr��before_subscribers�
callback_typer�s    ����r&�invoke_all_callbackszBS3ClientArgsCreator.get_crt_callback.<locals>.invoke_all_callbacks�sm����N�!�-��"4�4���m�F�M�B�B�N� �,��"3�3��*�
.��!�J�.��t�A�w�7��d�-�f�-�
.rEr_)rYr�r�r�r�r�s ```` r&r�z$S3ClientArgsCreator.get_crt_callback�s���	.� $�#rEc�N�d}t|jt�r7|j}|jj	|�}||j
d<n|j|j
d<|j
j
dd�j�}	tjjtjj|	tjjj��}
d|j
d<|j||||||��}||d	<|
|d
<|S)N�
ContentLength�Bodyr��CRC32)�	algorithm�locationzoverride-to-be-removed�
ContentMD5r~�
send_filepath�checksum_config)r�rnrrz�
get_file_sizero�popr�rr �S3ChecksumConfigr��S3ChecksumLocation�TRAILERr�)rYr�r�r�r�rr�r��data_lenr�r��make_request_argss            r&�!_get_make_request_args_put_objectz5S3ClientArgsCreator._get_make_request_args_put_object�s���
��i�'�'��-�%�-�-�M��~�~�3�3�M�B�H�4<�I� � ��1�+4�+<�+<�I� � ��(�&�1�1�5�5���
�
�%�'�	�!�)�)�4�4��i�i�3�3�4F�G��Y�Y�1�1�9�9�5�
��.F�	���\�*� �?�?�%��#��!5� 3�
@�
��.;��/�*�/>��+�,� � rEc��d}d}tjjd��}	t|jt
�rO|j}
|jj|
�}|jt||
||j��nt|j�}|j||||||��}||d<||d<|	|d<|S)NT)�validate_responser~�
recv_filepath�on_bodyr�)rr r�r�rnrrz�get_temp_filenamer��RenameTempFileHandler�OnBodyFileObjWriterr�)rYr�r�r�r�rr�r�r�r��final_filepathr�s            r&�!_get_make_request_args_get_objectz5S3ClientArgsCreator._get_make_request_args_get_objects����
��� �)�)�4�4�t�4�L���i�'�'��-�&�.�.�N� �N�N�<�<�^�L�M� �'�'�%��������
�*�)�*;�*;�<�G� �?�?�%��#��!5� 3�
@�
��.;��/�*�'.��)�$�/>��+�,� � rEc�F�|jj||�tt|j	�tj
�|j
|d||�|j
|d�d�}t|j�rttj��|d<|S)Nr�r�)r�typer��on_progress)r��signing_config)ryr�r(rr��DEFAULTr�rrlrr�V4_S3EXPRESS)rYr�r�r�r�rr�r�s        r&r�z2S3ClientArgsCreator._default_get_make_request_args,s����/�/�F�F��f����|�1�1�3�]�5J�5J���,�,��� 4�6I�� �0�0���D�
���y�/�/�0�2B�-�:�:�3��.�/�!� rEr�)	r�r�r�r]r�r�r�r�r�r_rEr&rPrP�s*��"�
�* ��$�2(!�T"!�H!rErPc��eZdZd�Zd�Zy)r�c�<�||_||_||_||_yr)r��_final_filename�_temp_filenamerN)rYr��final_filename�
temp_filenamer\s     r&r]zRenameTempFileHandler.__init__Is!��'���-���+�����rEc�l�|d}|r&|jj|j�y	|jj|j|j�y#t
$rJ}|jj|j�|jj|�Yd}~yd}~wwxYw)Nr�)rN�remove_filer��rename_filer�r�r�r�)rYr�r�r�s    r&rWzRenameTempFileHandler.__call__Os����w�����L�L�$�$�T�%8�%8�9�
3����(�(��'�'��)=�)=����
3����(�(��)<�)<�=��!�!�/�/��2�2��
3�s�0A � 	B3�)AB.�.B3N�r�r�r�r]rWr_rEr&r�r�Hs���3rEr�c��eZdZd�Zd�Zy)r�c��||_yr)r�r�s  r&r]zAfterDoneHandler.__init___s
��'��rEc�8�|jj�yr)r�rir�s  r&rWzAfterDoneHandler.__call__bs�����5�5�7rENr�r_rEr&r�r�^s��(�8rEr�c��eZdZd�Zd�Zy)r�c��||_yr)�_fileobj)rYrns  r&r]zOnBodyFileObjWriter.__init__gs	����
rEc�:�|jj|�yr)r��write)rYrIr�s   r&rWzOnBodyFileObjWriter.__call__js���
�
���E�"rENr�r_rEr&r�r�fs�� �#rEr�r)>�loggingrU�ior�awscrt.httpr�	awscrt.s3�botocore.awsrequestr!�botocore.session�awscrt.authrrrr�	awscrt.iorr	r
rrr
rrr�botocore.compatr�botocore.configr�botocore.exceptionsr�s3transfer.constantsr�s3transfer.exceptionsr�s3transfer.futuresrr�s3transfer.utilsrrrr�	getLoggerr�rHrr'rDr9rKr�r�r�r�r$rLr�rPr�r�r�r_rEr&�<module>r�s/�������������@�?��$�"�2�#�6�C���
��	�	�8�	$�����6"����"�f���R�j�$e�e�P"�&�"�*#B�*�#B�L?�?�&ZK�#;�ZK�z�g��*�*�&F<�F<�RV!�V!�r3�3�,8�8�#�#rE