Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/concurrent/futures/__pycache__/process.cpython-36.opt-2.pyc

3

��2aP�@s^dZddlZddlZddlmZddlZddlmZddlZddlmZddl	m
Z
ddlZddlZddl
mZddlZddlZej�Zdad	d
�ZdZGdd
�d
e�ZGdd�d�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�Zdd�Zdd�Z dd�Z!d d!�Z"da#da$d"d#�Z%d$d%�Z&Gd&d'�d'e'�Z(Gd(d)�d)ej)�Z*ej+e�dS)*z"Brian Quinlan (brian@sweetapp.com)�N)�_base)�Full)�SimpleQueue)�wait)�partialFcCsJdattj��}x|D]\}}|jd�qWx|D]\}}|j�q2WdS)NT)�	_shutdown�list�_threads_queues�items�put�join)r
�t�q�r�,/opt/alt/python36/lib64/python3.6/process.py�_python_exitOsr�c@seZdZdd�Zdd�ZdS)�_RemoteTracebackcCs
||_dS)N)�tb)�selfrrrr�__init__asz_RemoteTraceback.__init__cCs|jS)N)r)rrrr�__str__csz_RemoteTraceback.__str__N)�__name__�
__module__�__qualname__rrrrrrr`src@seZdZdd�Zdd�ZdS)�_ExceptionWithTracebackcCs0tjt|�||�}dj|�}||_d||_dS)N�z

"""
%s""")�	traceback�format_exception�typer�excr)rr rrrrrgs
z _ExceptionWithTraceback.__init__cCst|j|jffS)N)�_rebuild_excr r)rrrr�
__reduce__lsz"_ExceptionWithTraceback.__reduce__N)rrrrr"rrrrrfsrcCst|�|_|S)N)r�	__cause__)r rrrrr!os
r!c@seZdZdd�ZdS)�	_WorkItemcCs||_||_||_||_dS)N)�future�fn�args�kwargs)rr%r&r'r(rrrrtsz_WorkItem.__init__N)rrrrrrrrr$ssr$c@seZdZddd�ZdS)�_ResultItemNcCs||_||_||_dS)N)�work_id�	exception�result)rr*r+r,rrrr{sz_ResultItem.__init__)NN)rrrrrrrrr)zsr)c@seZdZdd�ZdS)�	_CallItemcCs||_||_||_||_dS)N)r*r&r'r()rr*r&r'r(rrrr�sz_CallItem.__init__N)rrrrrrrrr-�sr-cgs0t|�}x"ttj||��}|s"dS|Vq
WdS)N)�zip�tuple�	itertools�islice)�	chunksize�	iterables�it�chunkrrr�_get_chunks�sr6cs�fdd�|D�S)Ncsg|]}�|��qSrr)�.0r')r&rr�
<listcomp>�sz"_process_chunk.<locals>.<listcomp>r)r&r5r)r&r�_process_chunk�s	r9cCs�x�|jdd�}|dkr(|jtj��dSy|j|j|j�}WnBtk
r~}z&t||j	�}|jt
|j|d��WYdd}~XqX|jt
|j|d��qWdS)NT)�block)r+)r,)�getr�os�getpidr&r'r(�
BaseExceptionr�
__traceback__r)r*)�
call_queue�result_queueZ	call_item�r�er rrr�_process_worker�s
&
rDcCsxxr|j�rdSy|jdd�}Wntjk
r4dSX||}|jj�rh|jt||j|j	|j
�dd�q||=qqWdS)NF)r:T)Zfullr;�queueZEmptyr%Zset_running_or_notify_cancelrr-r&r'r()�pending_work_itemsZwork_idsr@r*�	work_itemrrr�_add_call_item_to_queue�s 

rHcs�d��fdd�}��fdd�}|j}�xlt||��dd��j�D�}	t|g|	�}
||
krf|j�}nr|���dk	r�d�_d�_d�x&|j�D]\}}
|
jj	t
d��~
q�W|j�x�j�D]}|j�q�W|�dSt
|t��r�j|�}|j���sR|�dSnJ|dk	�rR|j|jd�}
|
dk	�rR|j�rB|
jj	|j�n|
jj|j�~
|��|��r�y|�sr|�dSWntk
�r�YnXd�q(WdS)	Ncstp�dkp�jS)N)r�_shutdown_threadr)�executorrr�
shutting_down�sz/_queue_management_worker.<locals>.shutting_downcsZtdd��j�D��}xtd|�D]}�jd�q"W�j�x�j�D]}|j�qFWdS)Ncss|]}|j�VqdS)N)Zis_alive)r7�prrr�	<genexpr>�szD_queue_management_worker.<locals>.shutdown_worker.<locals>.<genexpr>r)�sum�values�rangeZ
put_nowait�closer)Znb_children_alive�irL)r@�	processesrr�shutdown_worker�sz1_queue_management_worker.<locals>.shutdown_workercSsg|]
}|j�qSr)�sentinel)r7rLrrrr8sz,_queue_management_worker.<locals>.<listcomp>Tz^A process in the process pool was terminated abruptly while the future was running or pending.)Z_readerrHrOrZrecv�_brokenrIr
r%Z
set_exception�BrokenProcessPool�clearZ	terminate�
isinstance�int�poprr*r+Z
set_resultr,r)Zexecutor_referencerSrFZwork_ids_queuer@rArKrT�readerZ	sentinelsZreadyZresult_itemr*rGrLr)r@rJrSr�_queue_management_worker�sb



r]cCshtrtrtt��daytjd�}Wnttfk
r:dSX|dkrHdS|dkrTdSd|att��dS)NT�SC_SEM_NSEMS_MAXr�z@system provides too few semaphores (%d available, 256 necessary)���)�_system_limits_checked�_system_limited�NotImplementedErrorr<�sysconf�AttributeError�
ValueError)Z	nsems_maxrrr�_check_system_limitsQsrgccs.x(|D] }|j�x|r$|j�VqWqWdS)N)�reverser[)�iterable�elementrrr�_chain_from_iterable_of_listshs
rkc@seZdZdS)rWN)rrrrrrrrWtsrWcsheZdZddd�Zdd�Zdd�Zdd	�Zejjj	e_	dd
d��fdd
�
Z
ddd�Zejjj	e_	�ZS)�ProcessPoolExecutorNcCs�t�|dkrtj�pd|_n|dkr.td��||_tj|jt�|_d|j_	t
�|_tj�|_
d|_i|_d|_tj�|_d|_d|_i|_dS)Nrrz"max_workers must be greater than 0TF)rgr<�	cpu_count�_max_workersrf�multiprocessingZQueue�EXTRA_QUEUED_CALLS�_call_queueZ
_ignore_epiper�
_result_queuerE�	_work_ids�_queue_management_thread�
_processesrI�	threadingZLock�_shutdown_lockrV�_queue_count�_pending_work_items)r�max_workersrrrr|s$


zProcessPoolExecutor.__init__cCsp|jfdd�}|jdkrl|j�tjttj||�|j|j	|j
|j|jfd�|_d|j_|jj
�|jt|j<dS)NcSs|jd�dS)N)r)�_rrrr�
weakref_cb�szFProcessPoolExecutor._start_queue_management_thread.<locals>.weakref_cb)�targetr'T)rrrt�_adjust_process_countrvZThreadr]�weakref�refruryrsrqZdaemon�startr	)rr|rrr�_start_queue_management_thread�s


z2ProcessPoolExecutor._start_queue_management_threadcCsJxDtt|j�|j�D].}tjt|j|jfd�}|j	�||j|j
<qWdS)N)r}r')rP�lenrurnroZProcessrDrqrrr��pid)rr{rLrrrr~�sz)ProcessPoolExecutor._adjust_process_countcOs�|j�t|jrtd��|jr$td��tj�}t||||�}||j|j	<|j
j|j	�|j	d7_	|jjd�|j
�|SQRXdS)NzKA child process terminated abruptly, the process pool is not usable anymorez*cannot schedule new futures after shutdownr)rwrVrWrI�RuntimeErrorrZFuturer$ryrxrsrrrr�)rr&r'r(�f�wrrr�submit�szProcessPoolExecutor.submitr)�timeoutr2cs:|dkrtd��t�jtt|�t|d|i�|d�}t|�S)Nrzchunksize must be >= 1.r2)r�)rf�super�maprr9r6rk)rr&r�r2r3�results)�	__class__rrr��szProcessPoolExecutor.mapTc	CsT|j�d|_WdQRX|jr8|jjd�|r8|jj�d|_d|_d|_d|_dS)NT)rwrIrtrrrrrqru)rrrrr�shutdown�s
zProcessPoolExecutor.shutdown)N)T)
rrrrr�r~r�r�Executor�__doc__r�r��
__classcell__rr)r�rrl{s
(	
rl),�
__author__�atexitr<�concurrent.futuresrrErrorZmultiprocessing.connectionrrvr�	functoolsrr0r�WeakKeyDictionaryr	rrrp�	Exceptionrrr!�objectr$r)r-r6r9rDrHr]rarbrgrkr�rWr�rl�registerrrrr�<module>.sH
		%s	

Hacked By AnonymousFox1.0, Coded By AnonymousFox