403Webshell
Server IP : 3.138.164.131  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux ns1.techtime.me 4.18.0-147.8.1.el8.lve.1.x86_64 #1 SMP Mon Jun 29 09:55:57 EDT 2020 x86_64
User : injazaat ( 1471)
PHP Version : 8.1.20
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/local/lib/python3.6/site-packages/s3transfer/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.6/site-packages/s3transfer/__pycache__/futures.cpython-36.pyc
3

�b`�R�@sBddlmZddlmZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZm
Z
ddlmZddlmZeje�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zeddg�Zed�Z ed �Z!dS)!�)�futures)�
namedtupleN)�MAXINT)�six)�CancelledError�TransferNotDoneError)�FunctionContainer)�
TaskSemaphorec@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
�BaseTransferFuturecCstd��dS)z-The metadata associated to the TransferFuture�metaN)�NotImplementedError)�self�r�8/tmp/pip-build-t4pk6ic9/s3transfer/s3transfer/futures.pyrszBaseTransferFuture.metacCstd��dS)zmDetermines if a TransferFuture has completed

        :returns: True if completed. False, otherwise.
        zdone()N)r)r
rrr�done$szBaseTransferFuture.donecCstd��dS)z�Waits until TransferFuture is done and returns the result

        If the TransferFuture succeeded, it will return the result. If the
        TransferFuture failed, it will raise the exception associated to the
        failure.
        zresult()N)r)r
rrr�result+szBaseTransferFuture.resultcCstd��dS)z6Cancels the request associated with the TransferFuturezcancel()N)r)r
rrr�cancel4szBaseTransferFuture.cancelN)�__name__�
__module__�__qualname__�propertyrrrrrrrrr
s	r
c@s0eZdZedd��Zedd��Zedd��ZdS)�BaseTransferMetacCstd��dS)z*The call args used in the transfer request�	call_argsN)r)r
rrrr:szBaseTransferMeta.call_argscCstd��dS)zThe unique id of the transfer�transfer_idN)r)r
rrrr?szBaseTransferMeta.transfer_idcCstd��dS)z.A dictionary that requesters can store data in�user_contextN)r)r
rrrrDszBaseTransferMeta.user_contextN)rrrrrrrrrrrr9src@sBeZdZddd�Zedd��Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�TransferFutureNcCs0||_|dkrt�|_||_|dkr,t�|_dS)a�The future associated to a submitted transfer request

        :type meta: TransferMeta
        :param meta: The metadata associated to the request. This object
            is visible to the requester.

        :type coordinator: TransferCoordinator
        :param coordinator: The coordinator associated to the request. This
            object is not visible to the requester.
        N)�_meta�TransferMeta�_coordinator�TransferCoordinator)r
rZcoordinatorrrr�__init__KszTransferFuture.__init__cCs|jS)N)r)r
rrrr^szTransferFuture.metacCs
|jj�S)N)rr)r
rrrrbszTransferFuture.donecCs>y
|jj�Stk
r8}z|j�|�WYdd}~XnXdS)N)rr�KeyboardInterruptr)r
�errrres

zTransferFuture.resultcCs|jj�dS)N)rr)r
rrrroszTransferFuture.cancelcCs$|j�std��|jj|dd�dS)z!Sets the exception on the future.z?set_exception can only be called once the transfer is complete.T)�overrideN)rrr�
set_exception)r
�	exceptionrrrr$rszTransferFuture.set_exception)NN)
rrrr rrrrrr$rrrrrJs

rc@sReZdZdZddd�Zedd��Zedd��Zed	d
��Zedd��Z	d
d�Z
dS)rz'Holds metadata about the TransferFutureNcCs||_||_d|_i|_dS)N)�
_call_args�_transfer_id�_size�
_user_context)r
rrrrrr }szTransferMeta.__init__cCs|jS)z*The call args used in the transfer request)r&)r
rrrr�szTransferMeta.call_argscCs|jS)zThe unique id of the transfer)r')r
rrrr�szTransferMeta.transfer_idcCs|jS)z)The size of the transfer request if known)r()r
rrr�size�szTransferMeta.sizecCs|jS)z.A dictionary that requesters can store data in)r))r
rrrr�szTransferMeta.user_contextcCs
||_dS)z�A method to provide the size of a transfer request

        By providing this value, the TransferManager will not try to
        call HeadObject or use the use OS to determine the size of the
        transfer.
        N)r()r
r*rrr�provide_transfer_size�sz"TransferMeta.provide_transfer_size)NN)rrr�__doc__r rrrr*rr+rrrrr{s
rc@s�eZdZdZd5dd�Zdd�Zedd��Zed	d
��Zedd��Z	ed
d��Z
dd�Zd6dd�Zdd�Z
defdd�Zdd�Zdd�Zdd�Zd7dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZdS)8rz*A helper class for managing TransferFutureNcCsb||_d|_d|_d|_t�|_g|_g|_tj	�|_
tj�|_tj�|_
tj�|_tj�|_dS)Nznot-started)r�_status�_result�
_exception�set�_associated_futures�_failure_cleanups�_done_callbacks�	threading�Event�_done_event�Lock�_lock�_associated_futures_lock�_done_callbacks_lock�_failure_cleanups_lock)r
rrrrr �s



zTransferCoordinator.__init__cCsd|jj|jfS)Nz%s(transfer_id=%s))�	__class__rr)r
rrr�__repr__�szTransferCoordinator.__repr__cCs|jS)N)r/)r
rrrr%�szTransferCoordinator.exceptionc	Cs|j�tj|j�SQRXdS)z�The list of futures associated to the inprogress TransferFuture

        Once the transfer finishes this list becomes empty as the transfer
        is considered done and there should be no running futures left.
        N)r9�copyr1)r
rrr�associated_futures�sz&TransferCoordinator.associated_futurescCs|jS)z;The list of callbacks to call when the TransferFuture fails)r2)r
rrr�failure_cleanups�sz$TransferCoordinator.failure_cleanupscCs|jS)a�The status of the TransferFuture

        The currently supported states are:
            * not-started - Has yet to start. If in this state, a transfer
              can be canceled immediately and nothing will happen.
            * queued - SubmissionTask is about to submit tasks
            * running - Is inprogress. In-progress as of now means that
              the SubmissionTask that runs the transfer is being executed. So
              there is no guarantee any transfer requests had been made to
              S3 if this state is reached.
            * cancelled - Was cancelled
            * failed - An exception other than CancelledError was thrown
            * success - No exceptions were thrown and is done.
        )r-)r
rrr�status�szTransferCoordinator.statusc	Cs(|j�d|_||_d|_WdQRXdS)a�Set a result for the TransferFuture

        Implies that the TransferFuture succeeded. This will always set a
        result because it is invoked on the final task where there is only
        ever one final task and it is ran at the very end of a transfer
        process. So if a result is being set for this final task, the transfer
        succeeded even if something came a long and canceled the transfer
        on the final task.
        N�success)r8r/r.r-)r
rrrr�
set_result�s
zTransferCoordinator.set_resultFc	Cs0|j� |j�s|r"||_d|_WdQRXdS)z�Set an exception for the TransferFuture

        Implies the TransferFuture failed.

        :param exception: The exception that cause the transfer to fail.
        :param override: If True, override any existing state.
        �failedN)r8rr/r-)r
r%r#rrrr$�sz!TransferCoordinator.set_exceptioncCs|jjt�|jr|j�|jS)z�Waits until TransferFuture is done and returns the result

        If the TransferFuture succeeded, it will return the result. If the
        TransferFuture failed, it will raise the exception associated to the
        failure.
        )r6�waitrr/r.)r
rrrr�szTransferCoordinator.result�cCsZ|j�J|j�sLd}tjd||�||�|_|jdkr:d}d|_|rL|j�WdQRXdS)z�Cancels the TransferFuture

        :param msg: The message to attach to the cancellation
        :param exc_type: The type of exception to set for the cancellation
        Fz%s cancel(%s) calledznot-startedT�	cancelledN)r8r�logger�debugr/r-�
announce_done)r
�msg�exc_typeZshould_announce_donerrrrs

zTransferCoordinator.cancelcCs|jd�dS)z+Sets the TransferFutrue's status to runningZqueuedN)�_transition_to_non_done_state)r
rrr�set_status_to_queuedsz(TransferCoordinator.set_status_to_queuedcCs|jd�dS)z+Sets the TransferFuture's status to runningZrunningN)rM)r
rrr�set_status_to_running!sz)TransferCoordinator.set_status_to_runningcCs6|j�&|j�r"td|j|f��||_WdQRXdS)Nz=Unable to transition from done state %s to non-done state %s.)r8r�RuntimeErrorrAr-)r
Z
desired_staterrrrM%sz1TransferCoordinator._transition_to_non_done_statecCsDtjd|||jf�|j||d�}|j|�|jt|j|��|S)a�Submits a task to a provided executor

        :type executor: s3transfer.futures.BoundedExecutor
        :param executor: The executor to submit the callable to

        :type task: s3transfer.tasks.Task
        :param task: The task to submit to the executor

        :type tag: s3transfer.futures.TaskTag
        :param tag: A tag to associate to the submitted task

        :rtype: concurrent.futures.Future
        :returns: A future representing the submitted task
        z;Submitting task %s to executor %s for transfer request: %s.)�tag)rHrIr�submit�add_associated_future�add_done_callbackr�remove_associated_future)r
�executor�taskrQ�futurerrrrR-s
zTransferCoordinator.submitcCs
|jdkS)z�Determines if a TransferFuture has completed

        :returns: False if status is equal to 'failed', 'cancelled', or
            'success'. True, otherwise
        rDrGrB)rDrGrB)rA)r
rrrrHszTransferCoordinator.donec	Cs"|j�|jj|�WdQRXdS)z6Adds a future to be associated with the TransferFutureN)r9r1�add)r
rXrrrrSPsz)TransferCoordinator.add_associated_futurec	Cs"|j�|jj|�WdQRXdS)z4Removes a future's association to the TransferFutureN)r9r1�remove)r
rXrrrrUUsz,TransferCoordinator.remove_associated_futurecOs.|j�|jjt|f|�|��WdQRXdS)z7Add a done callback to be invoked when transfer is doneN)r:r3�appendr)r
�function�args�kwargsrrrrTZsz%TransferCoordinator.add_done_callbackcOs.|j�|jjt|f|�|��WdQRXdS)z$Adds a callback to call upon failureN)r;r2r[r)r
r\r]r^rrr�add_failure_cleanupasz'TransferCoordinator.add_failure_cleanupcCs(|jdkr|j�|jj�|j�dS)aMAnnounce that future is done running and run associated callbacks

        This will run any failure cleanups if the transfer failed if not
        they have not been run, allows the result() to be unblocked, and will
        run any done callbacks associated to the TransferFuture if they have
        not already been ran.
        rBN)rA�_run_failure_cleanupsr6r0�_run_done_callbacks)r
rrrrJgs

z!TransferCoordinator.announce_donec	Cs(|j�|j|j�g|_WdQRXdS)N)r:�_run_callbacksr3)r
rrrratsz'TransferCoordinator._run_done_callbacksc	Cs(|j�|j|j�g|_WdQRXdS)N)r;rbr@r2)r
rrrr`|sz)TransferCoordinator._run_failure_cleanupscCsx|D]}|j|�qWdS)N)�
_run_callback)r
�	callbacks�callbackrrrrb�s
z"TransferCoordinator._run_callbackscCs6y
|�Wn&tk
r0tjd|dd�YnXdS)NzException raised in %s.T)�exc_info)�	ExceptionrHrI)r
rerrrrc�s
z!TransferCoordinator._run_callback)N)F)N)rrrr,r r=rr%r?r@rArCr$rrrrNrOrMrRrrSrUrTr_rJrar`rbrcrrrrr�s2





rc@s0eZdZejZd	dd�Zd
dd�Zddd�ZdS)�BoundedExecutorNcCs6||_|dkr|j}||jd�|_t|�|_||_dS)aDAn executor implentation that has a maximum queued up tasks

        The executor will block if the number of tasks that have been
        submitted and is currently working on is past its maximum.

        :params max_size: The maximum number of inflight futures. An inflight
            future means that the task is either queued up or is currently
            being executed. A size of None or 0 means that the executor will
            have no bound in terms of the number of inflight futures.

        :params max_num_threads: The maximum number of threads the executor
            uses.

        :type tag_semaphores: dict
        :params tag_semaphores: A dictionary where the key is the name of the
            tag and the value is the semaphore to use when limiting the
            number of tasks the executor is processing at a time.

        :type executor_cls: BaseExecutor
        :param underlying_executor_cls: The executor class that
            get bounded by this executor. If None is provided, the
            concurrent.futures.ThreadPoolExecutor class is used.
        N)�max_workers)Z_max_num_threads�EXECUTOR_CLS�	_executorr	�
_semaphore�_tag_semaphores)r
�max_sizeZmax_num_threadsZtag_semaphoresZexecutor_clsrrrr �s
zBoundedExecutor.__init__TcCsP|j}|r|j|}|j|j|�}t|j|j|�}t|jj|��}|j	|�|S)a1Submit a task to complete

        :type task: s3transfer.tasks.Task
        :param task: The task to run __call__ on


        :type tag: s3transfer.futures.TaskTag
        :param tag: An optional tag to associate to the task. This
            is used to override which semaphore to use.

        :type block: boolean
        :param block: True if to wait till it is possible to submit a task.
            False, if not to wait and raise an error if not able to submit
            a task.

        :returns: The future assocaited to the submitted task
        )
rlrm�acquirerr�release�ExecutorFuturerkrRrT)r
rWrQ�blockZ	semaphoreZ
acquire_tokenZrelease_callbackrXrrrrR�s

zBoundedExecutor.submitcCs|jj|�dS)N)rk�shutdown)r
rErrrrs�szBoundedExecutor.shutdown)NN)NT)T)	rrrrZThreadPoolExecutorrjr rRrsrrrrrh�s


%rhc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rqcCs
||_dS)a�A future returned from the executor

        Currently, it is just a wrapper around a concurrent.futures.Future.
        However, this can eventually grow to implement the needed functionality
        of concurrent.futures.Future if we move off of the library and not
        affect the rest of the codebase.

        :type future: concurrent.futures.Future
        :param future: The underlying future
        N)�_future)r
rXrrrr �szExecutorFuture.__init__cCs
|jj�S)N)rtr)r
rrrr�szExecutorFuture.resultcs�fdd�}|jj|�dS)aAdds a callback to be completed once future is done

        :parm fn: A callable that takes no arguments. Note that is different
            than concurrent.futures.Future.add_done_callback that requires
            a single argument for the future.
        cs��S)Nr)Zfuture_passed_to_callback)�fnrr�
done_callback�sz7ExecutorFuture.add_done_callback.<locals>.done_callbackN)rtrT)r
rurvr)rurrT�s
z ExecutorFuture.add_done_callbackcCs
|jj�S)N)rtr)r
rrrr�szExecutorFuture.doneN)rrrr rrTrrrrrrq�s
rqc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)�BaseExecutorzABase Executor class implementation needed to work with s3transferNcCsdS)Nr)r
rirrrr szBaseExecutor.__init__cOstd��dS)Nzsubmit())r)r
rur]r^rrrrRszBaseExecutor.submitTcCstd��dS)Nz
shutdown())r)r
rErrrrsszBaseExecutor.shutdown)N)T)rrrr,r rRrsrrrrrws
rwc@s"eZdZdZdd�Zddd�ZdS)	�NonThreadedExecutorz@A drop-in replacement non-threaded version of ThreadPoolExecutorcOsht�}y|||�}|j|�WnDtk
rbtj�dd�\}}tjd|||�|j||�YnX|S)N�z0Setting exception for %s to %s with traceback %s)�NonThreadedExecutorFuturerCrg�sysrfrHrI�set_exception_info)r
rur]r^rXrr"�tbrrrrRs

zNonThreadedExecutor.submitTcCsdS)Nr)r
rErrrrsszNonThreadedExecutor.shutdownN)T)rrrr,rRrsrrrrrxsrxc@sReZdZdZdd�Zdd�Zdd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)rzz�The Future returned from NonThreadedExecutor

    Note that this future is **not** thread-safe as it is being used
    from the context of a non-threaded environment.
    cCs"d|_d|_d|_d|_g|_dS)NF)r.r/�
_traceback�_doner3)r
rrrr &s
z"NonThreadedExecutorFuture.__init__cCs||_|j�dS)N)r.�	_set_done)r
rrrrrC-sz$NonThreadedExecutorFuture.set_resultcCs||_||_|j�dS)N)r/r~r�)r
r%�	tracebackrrrr|1sz,NonThreadedExecutorFuture.set_exception_infoNcCs$|jrtjt|j�|j|j�|jS)N)r/r�reraise�typer~r.)r
�timeoutrrrr6sz NonThreadedExecutorFuture.resultcCs*d|_x|jD]}|j|�qWg|_dS)NT)rr3�_invoke_done_callback)r
rvrrrr�<sz#NonThreadedExecutorFuture._set_donecCs||�S)Nr)r
rvrrrr�Bsz/NonThreadedExecutorFuture._invoke_done_callbackcCs|jS)N)r)r
rrrrEszNonThreadedExecutorFuture.donecCs"|jr|j|�n|jj|�dS)N)rr�r3r[)r
rurrrrTHsz+NonThreadedExecutorFuture.add_done_callback)N)rrrr,r rCr|rr�r�rrTrrrrrz s
rz�TaskTag�nameZin_memory_uploadZin_memory_download)"Z
concurrentr�collectionsrr>�loggingr{r4Zs3transfer.compatrrZs3transfer.exceptionsrrZs3transfer.utilsrr	�	getLoggerrrH�objectr
rrrrrhrqrwrxrzr�ZIN_MEMORY_UPLOAD_TAGZIN_MEMORY_DOWNLOAD_TAGrrrr�<module>
s2
1&qL#/

Youez - 2016 - github.com/yon3zu
LinuXploit