https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/s3transfer/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/s3transfer/__pycache__/tasks.cpython-310.pyc
o

�y�`�>�@sjddlZddlZddlmZe�e�ZGdd�de�ZGdd�de�Z	Gdd�de�Z
Gd	d
�d
e�ZdS)�N)�
get_callbacksc@s|eZdZdZ			ddd�Zdd�Zedd	��Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�Taskz�A task associated to a TransferFuture request

    This is a base class for other classes to subclass from. All subclassed
    classes must implement the main() method.
    NFcCsP||_||_|jduri|_||_|duri|_||_|jdur#g|_||_dS)a�
        :type transfer_coordinator: s3transfer.futures.TransferCoordinator
        :param transfer_coordinator: The context associated to the
            TransferFuture for which this Task is associated with.

        :type main_kwargs: dict
        :param main_kwargs: The keyword args that can be immediately supplied
            to the _main() method of the task

        :type pending_main_kwargs: dict
        :param pending_main_kwargs: The keyword args that are depended upon
            by the result from a dependent future(s). The result returned by
            the future(s) will be used as the value for the keyword argument
            when _main() is called. The values for each key can be:
                * a single future - Once completed, its value will be the
                  result of that single future
                * a list of futures - Once all of the futures complete, the
                  value used will be a list of each completed future result
                  value in order of when they were originally supplied.

        :type done_callbacks: list of callbacks
        :param done_callbacks: A list of callbacks to call once the task is
            done completing. Each callback will be called with no arguments
            and will be called no matter if the task succeeds or an exception
            is raised.

        :type is_final: boolean
        :param is_final: True, to indicate that this task is the final task
            for the TransferFuture request. By setting this value to True, it
            will set the result of the entire TransferFuture to the result
            returned by this task's main() method.
        N)�_transfer_coordinator�_main_kwargs�_pending_main_kwargs�_done_callbacks�	_is_final)�self�transfer_coordinator�main_kwargs�pending_main_kwargs�done_callbacks�is_final�r�2/usr/lib/python3/dist-packages/s3transfer/tasks.py�__init__s#


z
Task.__init__cCs,gd�}|�|j|�}d|jj|jj|fS)N)�bucket�key�part_number�final_filename�transfer_future�offset�
extra_argsz%s(transfer_id=%s, %s))�"_get_kwargs_with_params_to_includer�	__class__�__name__r�transfer_id)r	�params_to_display�main_kwargs_to_displayrrr�__repr__Os��z
Task.__repr__cCs|jjS)z8The id for the transfer request that the task belongs to)rr)r	rrrr\szTask.transfer_idcCs&i}|D]}||vr||||<q|S�Nr)r	�kwargs�include�filtered_kwargs�paramrrrras�z'Task._get_kwargs_with_params_to_includecCs,i}|��D]
\}}||vrq|||<q|Sr )�items)r	r!�excluder#r$�valuerrr�"_get_kwargs_with_params_to_excludehs
z'Task._get_kwargs_with_params_to_excludec
Cs�zVz(|��|��}|j��s(|�|�WW|jD]}|�q|jr'|j��SSWnty@}z|�	|�WYd}~nd}~wwW|jD]}|�qE|jrU|j��dSdS|jD]}|�qZ|jri|j��ww)z9The callable to use when submitting a Task to an executorN)
�_wait_on_dependent_futures�_get_all_main_kwargsr�done�
_execute_mainrr�
announce_done�	Exception�_log_and_set_exception)r	r!�
done_callback�errr�__call__ps4

�����
�
��z
Task.__call__cCsJdg}|�||�}t�d||f�|jdi|��}|jr#|j�|�|S)N�dataz Executing task %s with kwargs %sr)r(�logger�debug�_mainrr�
set_result)r	r!�params_to_exclude�kwargs_to_display�return_valuerrrr,�s�
�zTask._execute_maincCstjddd�|j�|�dS)NzException raised.T)�exc_info)r4r5r�
set_exception)r	�	exceptionrrrr/�szTask._log_and_set_exceptioncK�td��)z�The method that will be ran in the executor

        This method must be implemented by subclasses from Task. main() can
        be implemented with any arguments decided upon by the subclass.
        z_main() must be implemented��NotImplementedError)r	r!rrrr6�sz
Task._maincCsFg}|j��D]\}}t|t�r|�|�q|�|�q|�|�dSr )rr%�
isinstance�list�extend�append�_wait_until_all_complete)r	�futures_to_wait_on�_�futurerrrr)�s
zTask._wait_on_dependent_futuresc	CsTt�d||�|D]}z
t�d||�|��Wq	ty!Yq	wt�d|�dS)Nz-%s about to wait for the following futures %sz%s about to wait for %sz%%s done waiting for dependent futures)r4r5�resultr.)r	�futuresrHrrrrE�s	��zTask._wait_until_all_completecCs\t�|j�}|j��D] \}}t|t�r#g}|D]	}|�|���qn|��}|||<q|Sr )�copyrrr%rArBrDrI)r	r!r�
pending_valuerIrHrrrr*�s
�
zTask._get_all_main_kwargs)NNNF)r�
__module__�__qualname__�__doc__rr�propertyrrr(r2r,r/r6r)rEr*rrrrrs$
�3

rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SubmissionTaskz�A base class for any submission task

    Submission tasks are the top-level task used to submit a series of tasks
    to execute a particular transfer.
    c
Ks�z$|j��t|d�}|D]}|�q
|j��|jdd|i|��WdStyE}z|�|�|��|j��WYd}~dSd}~ww)a>
        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The transfer future associated with the
            transfer request that tasks are being submitted for

        :param kwargs: Any additional kwargs that you may want to pass
            to the _submit() method
        �queuedrNr)	r�set_status_to_queuedr�set_status_to_running�_submit�
BaseExceptionr/�+_wait_for_all_submitted_futures_to_completer-)r	rr!�on_queued_callbacks�on_queued_callbackr1rrrr6�s	




��zSubmissionTask._maincKr>)aWThe submition method to be implemented

        :type transfer_future: s3transfer.futures.TransferFuture
        :param transfer_future: The transfer future associated with the
            transfer request that tasks are being submitted for

        :param kwargs: Any additional keyword arguments you want to be passed
            in
        z_submit() must be implementedr?)r	rr!rrrrUs
zSubmissionTask._submitcCs:|jj}|r|�|�|jj}||krdS|}|sdSdSr )r�associated_futuresrE)r	�submitted_futures�possibly_more_submitted_futuresrrrrW$s
��z:SubmissionTask._wait_for_all_submitted_futures_to_completeN)rrMrNrOr6rUrWrrrrrQ�s
/rQc@�eZdZdZdd�ZdS)�CreateMultipartUploadTaskz#Task to initiate a multipart uploadcCs8|jd||d�|��}|d}|jj|j|||d�|S)ap
        :param client: The client to use when calling CreateMultipartUpload
        :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 intialization.

        :returns: The upload id of the multipart upload
        )�Bucket�Key�UploadId)r_r`raNr)�create_multipart_uploadr�add_failure_cleanup�abort_multipart_upload)r	�clientrrr�response�	upload_idrrrr6As���zCreateMultipartUploadTask._mainN�rrMrNrOr6rrrrr^?�r^c@r])�CompleteMultipartUploadTaskz#Task to complete a multipart uploadcCs"|jd|||d|id�|��dS)az
        :param client: The client to use when calling CompleteMultipartUpload
        :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 parts: A list of parts to use to complete the multipart upload::

            [{'Etag': etag_value, 'PartNumber': part_number}, ...]

            Each element in the list consists of a return value from
            ``UploadPartTask.main()``.
        :param extra_args:  A dictionary of any extra arguments that may be
            used in completing the multipart transfer.
        �Parts)r_r`ra�MultipartUploadNr)�complete_multipart_upload)r	rerrrg�partsrrrrr6Zs�
�z!CompleteMultipartUploadTask._mainNrhrrrrrjXrirj)rK�logging�s3transfer.utilsr�	getLoggerrr4�objectrrQr^rjrrrr�<module>s
N\

https://t.me/RX1948 - 2025