AlkantarClanX12

Your IP : 18.216.99.18


Current Path : /opt/alt/python38/lib64/python3.8/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/concurrent/futures/__pycache__/_base.cpython-38.opt-2.pyc

U

i�fY�
@spdZddlZddlZddlZddlZdZdZdZdZdZ	dZ
d	Zd
ZdZ
e	e
eee
gZe	de
d
edede
diZe�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�Zd#d$�Zd%d&�Zd3d'd(�Ze� d)d*�Z!defd+d,�Z"Gd-d.�d.e�Z#Gd/d0�d0e�Z$Gd1d2�d2e%�Z&dS)4z"Brian Quinlan (brian@sweetapp.com)�N�FIRST_COMPLETED�FIRST_EXCEPTION�
ALL_COMPLETED�
_AS_COMPLETED�PENDING�RUNNING�	CANCELLED�CANCELLED_AND_NOTIFIED�FINISHED�pending�running�	cancelled�finishedzconcurrent.futuresc@seZdZdS)�ErrorN��__name__�
__module__�__qualname__�rr�=/opt/alt/python38/lib64/python3.8/concurrent/futures/_base.pyr,src@seZdZdS)�CancelledErrorNrrrrrr0src@seZdZdS)�TimeoutErrorNrrrrrr4src@seZdZdS)�InvalidStateErrorNrrrrrr8src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_WaitercCst��|_g|_dS�N)�	threadingZEvent�event�finished_futures��selfrrr�__init__>s
z_Waiter.__init__cCs|j�|�dSr�r�append�r�futurerrr�
add_resultBsz_Waiter.add_resultcCs|j�|�dSrr!r#rrr�
add_exceptionEsz_Waiter.add_exceptioncCs|j�|�dSrr!r#rrr�
add_cancelledHsz_Waiter.add_cancelledN)rrrr r%r&r'rrrrr<srcs@eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�ZS)	�_AsCompletedWaitercstt|���t��|_dSr)�superr(r r�Lock�lockr��	__class__rrr Nsz_AsCompletedWaiter.__init__c	s0|j� tt|��|�|j��W5QRXdSr)r+r)r(r%r�setr#r,rrr%Rsz_AsCompletedWaiter.add_resultc	s0|j� tt|��|�|j��W5QRXdSr)r+r)r(r&rr.r#r,rrr&Wsz _AsCompletedWaiter.add_exceptionc	s0|j� tt|��|�|j��W5QRXdSr)r+r)r(r'rr.r#r,rrr'\sz _AsCompletedWaiter.add_cancelled)rrrr r%r&r'�
__classcell__rrr,rr(Ksr(cs4eZdZ�fdd�Z�fdd�Z�fdd�Z�ZS)�_FirstCompletedWaitercst��|�|j��dSr)r)r%rr.r#r,rrr%dsz _FirstCompletedWaiter.add_resultcst��|�|j��dSr)r)r&rr.r#r,rrr&hsz#_FirstCompletedWaiter.add_exceptioncst��|�|j��dSr)r)r'rr.r#r,rrr'lsz#_FirstCompletedWaiter.add_cancelled)rrrr%r&r'r/rrr,rr0asr0csHeZdZ�fdd�Zdd�Z�fdd�Z�fdd�Z�fd	d
�Z�ZS)�_AllCompletedWaitercs$||_||_t��|_t���dSr)�num_pending_calls�stop_on_exceptionrr*r+r)r )rr2r3r,rrr ss
z_AllCompletedWaiter.__init__c	Cs4|j�$|jd8_|js&|j��W5QRXdS)N�)r+r2rr.rrrr�_decrement_pending_callsysz,_AllCompletedWaiter._decrement_pending_callscst��|�|��dSr)r)r%r5r#r,rrr%sz_AllCompletedWaiter.add_resultcs*t��|�|jr|j��n|��dSr)r)r&r3rr.r5r#r,rrr&�sz!_AllCompletedWaiter.add_exceptioncst��|�|��dSr)r)r'r5r#r,rrr'�sz!_AllCompletedWaiter.add_cancelled)	rrrr r5r%r&r'r/rrr,rr1ps
r1c@s$eZdZdd�Zdd�Zdd�ZdS)�_AcquireFuturescCst|td�|_dS)N)�key)�sorted�id�futures)rr:rrrr �sz_AcquireFutures.__init__cCs|jD]}|j��qdSr)r:�
_condition�acquirer#rrr�	__enter__�s
z_AcquireFutures.__enter__cGs|jD]}|j��qdSr)r:r;�release)r�argsr$rrr�__exit__�s
z_AcquireFutures.__exit__N)rrrr r=r@rrrrr6�sr6cCs�|tkrt�}nZ|tkr t�}nJtdd�|D��}|tkrHt|dd�}n"|tkr^t|dd�}ntd|��|D]}|j	�
|�qn|S)Ncss|]}|jttfkVqdSr��_stater	r
��.0�frrr�	<genexpr>�sz._create_and_install_waiters.<locals>.<genexpr>T)r3FzInvalid return condition: %r)rr(rr0�sumrr1r�
ValueError�_waitersr")�fs�return_when�waiterZ
pending_countrErrr�_create_and_install_waiters�s�rMc	csP|rL|d}|D]}|�|�q|j�|j�|�W5QRX~|��VqdS)N���)�remover;rI�pop)rJrL�ref_collectrEZfutures_setrrr�_yield_finished_futures�srRc	csB|dk	r|t��}t|�}t|�}t|��*tdd�|D��}||}t|t�}W5QRXt|�}z�t|||fd�EdH|�r|dkr�d}n(|t��}|dkr�tdt|�|f��|j
�|�|j�|j}g|_|j
��W5QRX|��t||||fd�EdHq|W5|D]$}|j�|j	�
|�W5QRX�qXdS)Ncss |]}|jttfkr|VqdSrrArCrrrrF�s�zas_completed.<locals>.<genexpr>)rQrz%d (of %d) futures unfinished)�time�	monotonicr.�lenr6rMr�listr;rIrOrRrr�waitr+r�clear�reverse)	rJ�timeout�end_timeZ
total_futuresrrrLrEZwait_timeoutrrr�as_completed�sL
�����r\�DoneAndNotDoneFuturesz
done not_donec
Cs
t|���tdd�|D��}t|�|}|tkrJ|rJt||�W5QR�S|tkr~|r~tdd�|D��r~t||�W5QR�St|�t|�kr�t||�W5QR�St||�}W5QRX|j�	|�|D]"}|j
�|j�|�W5QRXq�|�
|j�t|t|�|�S)Ncss |]}|jttfkr|VqdSrrArCrrrrF!s�zwait.<locals>.<genexpr>css&|]}|��s|��dk	r|VqdSr)r
�	exceptionrCrrrrF(s�)r6r.rr]r�anyrUrMrrWr;rIrO�updater)rJrZrK�doneZnot_donerLrErrrrWs"
rWc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zddd�Zddd�Z
dd�Zdd�Zdd�ZdS) �FuturecCs,t��|_t|_d|_d|_g|_g|_dSr)	rZ	Conditionr;rrB�_result�
_exceptionrI�_done_callbacksrrrrr <s
zFuture.__init__c	Cs>|jD]2}z||�Wqtk
r6t�d|�YqXqdS�Nz!exception calling callback for %r)re�	Exception�LOGGERr^)r�callbackrrr�_invoke_callbacksEs

zFuture._invoke_callbacksc
Cs�|j��|jtkrx|jrHd|jjt|�t|j|jjjfW5QR�Sd|jjt|�t|j|jjjfW5QR�Sd|jjt|�t|jfW5QR�SQRXdS)Nz<%s at %#x state=%s raised %s>z <%s at %#x state=%s returned %s>z<%s at %#x state=%s>)	r;rBr
rdr-rr9�_STATE_TO_DESCRIPTION_MAPrcrrrr�__repr__Ls(
���zFuture.__repr__c	Csf|j�N|jttfkr$W5QR�dS|jttfkr@W5QR�dSt|_|j��W5QRX|��dS)NFT)r;rBrr
rr	�
notify_allrjrrrr�cancel`sz
Future.cancelc
Cs,|j�|jttfkW5QR�SQRXdSr)r;rBrr	rrrrr
sszFuture.cancelledc
Cs(|j�|jtkW5QR�SQRXdSr)r;rBrrrrrrxszFuture.runningc
Cs.|j�|jtttfkW5QR�SQRXdSr)r;rBrr	r
rrrrra}szFuture.donecCs$|jrz
|j�W5d}Xn|jSdSr)rdrcrrrrZ__get_result�s

zFuture.__get_resultc	Csn|j�0|jtttfkr2|j�|�W5QR�dSW5QRXz||�Wn tk
rht�	d|�YnXdSrf)
r;rBrr	r
rer"rgrhr^)r�fnrrr�add_done_callback�szFuture.add_done_callbackNc
Cs�z�|j��|jttfkr t��n"|jtkrB|��W5QR�W�ZS|j�|�|jttfkrdt��n(|jtkr�|��W5QR�W�St��W5QRXW5d}XdSr)	r;rBrr	rr
�_Future__get_resultrWr�rrZrrr�result�s

z
Future.resultc
Cs�|j�||jttfkrt��n|jtkr:|jW5QR�S|j�|�|jttfkr\t��n"|jtkrx|jW5QR�St��W5QRXdSr)	r;rBrr	rr
rdrWrrrrrrr^�s

zFuture.exceptionc	Cs�|j�t|jtkr<t|_|jD]}|�|�qW5QR�dS|jtkrZt|_W5QR�dSt�	dt
|�|j�td��W5QRXdS)NFTz!Future %s in unexpected state: %szFuture in unexpected state)r;rBrr	rIr'rrrhZcriticalr9�RuntimeError)rrLrrr�set_running_or_notify_cancel�s


�z#Future.set_running_or_notify_cancelc	Csl|j�T|jttthkr*td�|j|���||_t|_|jD]}|�	|�q<|j�
�W5QRX|��dS�Nz{}: {!r})r;rBrr	r
r�formatrcrIr%rmrj)rrsrLrrr�
set_result
s
zFuture.set_resultc	Csl|j�T|jttthkr*td�|j|���||_t|_|jD]}|�	|�q<|j�
�W5QRX|��dSrv)r;rBrr	r
rrwrdrIr&rmrj)rr^rLrrr�
set_exceptions
zFuture.set_exception)N)N)rrrr rjrlrnr
rrarqrprsr^rurxryrrrrrb9s	

#
"(rbc@sDeZdZdd�Zde_ddd�dd�Zdd
d�Zdd
�Zdd�ZdS)�ExecutorcOs\t|�dkrnD|std��n6d|kr>ddl}|jdtdd�ntdt|�d��t��dS)	N�z:descriptor 'submit' of 'Executor' object needs an argumentrorz.Passing 'fn' as keyword argument is deprecated)�
stacklevelz6submit expected at least 1 positional argument, got %dr4)rU�	TypeError�warnings�warn�DeprecationWarning�NotImplementedError)r?�kwargsr~rrr�submit.s	
�
�zExecutor.submitz($self, fn, /, *args, **kwargs)Nr4)rZ�	chunksizecsB�dk	r�t�����fdd�t|�D�����fdd�}|�S)Ncsg|]}�j�f|���qSr)r�)rDr?)rorrr�
<listcomp>`sz Executor.map.<locals>.<listcomp>c	3s\zB����r@�dkr&�����Vq
�����t���Vq
W5�D]}|��qHXdSr)rnrYrPrsrSrT)r$)r[rJrZrr�result_iteratordsz%Executor.map.<locals>.result_iterator)rSrT�zip)rrorZr��	iterablesr�r)r[rorJrrZr�mapGs

zExecutor.mapTcCsdSrr)rrWrrr�shutdownsszExecutor.shutdowncCs|Srrrrrrr=�szExecutor.__enter__cCs|jdd�dS)NT)rWF)r�)r�exc_typeZexc_valZexc_tbrrrr@�szExecutor.__exit__)T)	rrrr��__text_signature__r�r�r=r@rrrrrz+s,

rzc@seZdZdS)�BrokenExecutorNrrrrrr��sr�)N)'�
__author__�collectionsZloggingrrSrrrrrrrr	r
Z_FUTURE_STATESrkZ	getLoggerrhrgrrrr�objectrr(r0r1r6rMrRr\�
namedtupler]rWrbrzrtr�rrrr�<module>sh�	�	

>�1s]