AlkantarClanX12

Your IP : 18.117.12.181


Current Path : /opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/pool.cpython-311.opt-2.pyc

�

c��f�����ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddl
mZm
Z
ddlmZdZd	Zd
ZdZej��Zd�Zd
�ZGd�de��ZGd�d��Zd�ZGd�de��Z		d%d�Zd�ZGd�de��Z Gd�de!��Z"Gd�de!��Z#e#Z$Gd�de#��Z%Gd �d!e!��Z&Gd"�d#e&��Z'Gd$�de"��Z(dS)&�Pool�
ThreadPool�N�)�util)�get_context�TimeoutError)�wait�INIT�RUN�CLOSE�	TERMINATEc�.�tt|���S�N)�list�map��argss �;/opt/alt/python311/lib64/python3.11/multiprocessing/pool.py�mapstarr/s����T�
����c�^�ttj|d|d����S)Nrr)r�	itertools�starmaprs r�starmapstarr2s%���	�!�$�q�'�4��7�3�3�4�4�4rc��eZdZd�Zd�ZdS)�RemoteTracebackc��||_dSr��tb)�selfrs  r�__init__zRemoteTraceback.__init__:s
������rc��|jSrr�r s r�__str__zRemoteTraceback.__str__<s	���w�rN)�__name__�
__module__�__qualname__r!r$�rrrr9s2�������������rrc��eZdZd�Zd�ZdS)�ExceptionWithTracebackc��tjt|��||��}d�|��}||_d|z|_dS)N�z

"""
%s""")�	traceback�format_exception�type�join�excr)r r1rs   rr!zExceptionWithTraceback.__init__@sB��
�
'��S�	�	�3��
;�
;��
�W�W�R�[�[����� �2�%����rc�,�t|j|jffSr)�rebuild_excr1rr#s r�
__reduce__z!ExceptionWithTraceback.__reduce__Es���T�X�t�w�/�/�/rN)r%r&r'r!r4r(rrr*r*?s2������&�&�&�
0�0�0�0�0rr*c�.�t|��|_|Sr)r�	__cause__)r1rs  rr3r3Hs��#�B�'�'�C�M��Jrc�,��eZdZ	�fd�Zd�Zd�Z�xZS)�MaybeEncodingErrorc���t|��|_t|��|_tt|���|j|j��dSr)�reprr1�value�superr8r!)r r1r;�	__class__s   �rr!zMaybeEncodingError.__init__TsH�����9�9����%�[�[��
�
� �$�'�'�0�0���4�:�F�F�F�F�Frc�(�d|j�d|j�d�S)NzError sending result: 'z'. Reason: '�')r;r1r#s rr$zMaybeEncodingError.__str__Ys"���=A�Z�Z�Z�=A�X�X�X�G�	Grc�(�d|jj�d|�d�S)N�<z: �>)r=r%r#s r�__repr__zMaybeEncodingError.__repr__]s���!�^�4�4�4�d�d�d�;�;r)r%r&r'r!r$rC�
__classcell__�r=s@rr8r8Psc�������'�G�G�G�G�G�
G�G�G�<�<�<�<�<�<�<rr8r(Fc��|�=t|t��r|dks"td�|�����|j}|j}t
|d��r2|j���|j	���|�||�d}|�
|�r%||k�r	|��}	n+#ttf$rtj
d��Yn�wxYw|	�tj
d��n�|	\}
}}}
}	d||
i|��f}n;#t$r.}|r|turt!||j��}d|f}Yd}~nd}~wwxYw	||
||f��nT#t$rG}t%||d��}tj
d	|z��||
|d|ff��Yd}~nd}~wwxYwdx}	x}
x}x}x}
}|dz
}|��|r||k��tj
d
|z��dS)NrzMaxtasks {!r} is not valid�_writerrz)worker got EOFError or OSError -- exitingzworker got sentinel -- exitingTFz0Possible encoding error while sending result: %szworker exiting after %d tasks)�
isinstance�int�AssertionError�format�put�get�hasattrrG�close�_reader�EOFError�OSErrorr�debug�	Exception�_helper_reraises_exceptionr*�
__traceback__r8)�inqueue�outqueue�initializer�initargs�maxtasks�wrap_exceptionrLrM�	completed�task�job�i�funcr�kwds�result�e�wrappeds                  r�workerrfas�����z�(�C�'@�'@��+3�q�=�=��9�@�@��J�J�K�K�K�
�,�C�
�+�C��w�	�"�"�!������������ � � �����X����I�
�
�x�
�I��,@�,@�	��3�5�5�D�D���'�"�	�	�	��J�B�C�C�C��E�	�����<��J�7�8�8�8��#'� ��Q��d�D�	 ��D�D�$�/�$�/�/�0�F�F���	 �	 �	 ��
?�$�.H�"H�"H�*�1�a�o�>�>���Q�Z�F�F�F�F�F�F�����	 ����	,��C��a�� �!�!�!�!���	,�	,�	,�(��F�1�I�6�6�G��J�I���
�
�
��C��a�%��)�*�+�+�+�+�+�+�+�+�����		,����48�7��7�s�7�V�7�d�7�T�D��Q��	�7�
�x�
�I��,@�,@�8	�J�.��:�;�;�;�;�;sB�&
B1�1%C�C�<
D�
D?�$D:�:D?�E�
F#�=F�F#c��	|�rr()�exs rrUrU�s
��F�
�Hrc�0��eZdZ	dd��fd�
Z�fd�Z�xZS)�
_PoolCacheN��notifierc�H��||_t��j|i|��dSr)rlr<r!)r rlrrbr=s    �rr!z_PoolCache.__init__�s,��� ��
������$�'�$�'�'�'�'�'rc���t���|��|s|j�d��dSdSr)r<�__delitem__rlrL)r �itemr=s  �rroz_PoolCache.__delitem__�sK���
�����D�!�!�!��	$��M���d�#�#�#�#�#�	$�	$r)r%r&r'r!rorDrEs@rrjrj�se��������+/�(�(�(�(�(�(�(�
$�
$�
$�
$�
$�
$�
$�
$�
$rrjc���eZdZ	dZed���Z		d(d�Zeje	fd�Z
d�Zd�Zed	���Z
ed
���Zd�Zed���Zed
���Zd�Zd�Zdifd�Zd)d�Zd)d�Z		d*d�Zd�Zd+d�Zd+d�Zdiddfd�Z		d*d�Z		d*d�Zed)d���Zed���Z ed���Z!ed���Z"ed���Z#d �Z$d!�Z%d"�Z&d#�Z'ed$���Z(ed%���Z)d&�Z*d'�Z+dS),rTc��|j|i|��Sr��Process)�ctxrrbs   rrtzPool.Process�s���s�{�D�)�D�)�)�)rNr(c�&�g|_t|_|p
t��|_|���t
j��|_|j���|_	t|j	���|_||_||_
||_|�tj��pd}|dkrt#d���|�*t%|t&��r|dkrt#d���|�t)|��st+d���||_	|���nR#t0$rE|jD]}|j�|����|jD]}|�����wxYw|���}t;jt>j |j|j|j|j!|j|j|j"|j#|j
|j|j|j$||j	f���|_%d|j%_&tN|j%_|j%�(��t;jt>j)|j|j*|j#|j|jf���|_+d|j+_&tN|j+_|j+�(��t;jt>j,|j#|j-|jf���|_.d|j._&tN|j._|j.�(��t_j0||j1|j|j"|j#|j|j	|j%|j+|j.|jf	d	�
��|_2tN|_dS)Nrkrz&Number of processes must be at least 1rz/maxtasksperchild must be a positive int or Nonezinitializer must be a callable��targetrT�)r�exitpriority)3�_poolr
�_stater�_ctx�
_setup_queues�queue�SimpleQueue�
_taskqueue�_change_notifierrj�_cache�_maxtasksperchild�_initializer�	_initargs�os�	cpu_count�
ValueErrorrHrI�callable�	TypeError�
_processes�_repopulate_poolrT�exitcode�	terminater0�_get_sentinels�	threading�Threadr�_handle_workersrt�_inqueue�	_outqueue�_wrap_exception�_worker_handler�daemonr�start�
_handle_tasks�
_quick_put�
_task_handler�_handle_results�
_quick_get�_result_handlerr�Finalize�_terminate_pool�
_terminate)r �	processesrYrZ�maxtasksperchild�context�p�	sentinelss        rr!z
Pool.__init__�s_����
�����,�{�}�}��	��������+�-�-���!%�	� 5� 5� 7� 7��� �$�*?�@�@�@���!1���'���!���������+�!�I��q�=�=��E�F�F�F��'��.��4�4�
T�8H�A�8M�8M� �!R�S�S�S��"�8�K�+@�+@�"��<�=�=�=�#���	��!�!�#�#�#�#���	�	�	��Z�
"�
"���:�%��K�K�M�M�M���Z�
�
����������
	�����'�'�)�)�	�(�/��'��+�t���	�4�<��/�4�:�t�}�d�n��#�T�^�T�5K��&�	�4�3H�J� � � ���'+���#�&)���#���"�"�$�$�$�'�-��%��/�4�?�D�N��*�d�k�+������
%)���!�$'���!��� � �"�"�"�(�/��'��.�$�/�4�;�?� � � ���'+���#�&)���#���"�"�$�$�$��-��$�&��/�4�=�$�.�$�*��'��)=�t�?Q��&���5�����������s
�"D7�7AFc��|j|krC|d|��t|���t|dd���|j�d��dSdSdS)Nz&unclosed running multiprocessing pool )�sourcer�)r|�ResourceWarning�getattrr�rL)r �_warnrs   r�__del__zPool.__del__
sy���;�#����E�C�4�C�C�!�$�
0�
0�
0�
0��t�/��6�6�B��%�)�)�$�/�/�/�/�/�	��C�Brc
�p�|j}d|j�d|j�d|j�dt	|j���d�	S)NrA�.z state=z pool_size=rB)r=r&r'r|�lenr{)r �clss  rrCz
Pool.__repr__sY���n��0�C�N�0�0�S�%5�0�0���0�0� ���_�_�0�0�0�	1rc�B�|jjg}|jjg}g|�|�Sr)r�rPr�)r �task_queue_sentinels�self_notifier_sentinelss   rr�zPool._get_sentinelss1�� $�� 6�7��#'�#8�#@�"A��@�%�@�(?�@�@rc��d�|D��S)Nc�<�g|]}t|d���|j��S)�sentinel)rNr�)�.0rfs  r�
<listcomp>z.Pool._get_worker_sentinels.<locals>.<listcomp>s8��8�8�8�F�"�6�:�6�6�8���8�8�8rr(��workerss r�_get_worker_sentinelszPool._get_worker_sentinelss#��8�8��8�8�8�	8rc���	d}ttt|������D]A}||}|j�0t	jd|z��|���d}||=�B|S)NF�cleaning up worker %dT)�reversed�ranger�r�rrSr0)�pool�cleanedr`rfs    r�_join_exited_workerszPool._join_exited_workers!sy��	����%��D�	�	�*�*�+�+�	�	�A��!�W�F���*��
�2�Q�6�7�7�7����
�
�
�����G���rc��|�|j|j|j|j|j|j|j|j|j	|j
�
�
Sr)�_repopulate_pool_staticr}rtr�r{r�r�r�r�r�r�r#s rr�zPool._repopulate_pool1sN���+�+�D�I�t�|�,0�O�,0�J��
�,0�N�D�<M�,0�N�,0�,B�,0�,@�
B�B�	Brc
�F�	t|t|��z
��D]}
||t||||||	f���}|j�dd��|_d|_|���|�|��tj	d����dS)Nrwrt�
PoolWorkerTzadded worker)
r�r�rf�name�replacer�r��appendrrS)rurtr�r�rWrXrYrZr�r\r`�ws            rr�zPool._repopulate_pool_static:s���	��y�3�t�9�9�,�-�-�
	'�
	'�A����F�%�x�)�&�(8�,�.�/�/�/�A�
�V�^�^�I�|�<�<�A�F��A�H�
�G�G�I�I�I��K�K��N�N�N��J�~�&�&�&�&�
	'�
	'rc
��	t�|��r%t�||||||||||	�
�
dSdSr)rr�r�)
rurtr�r�rWrXrYrZr�r\s
          r�_maintain_poolzPool._maintain_poolMsa��	��$�$�T�*�*�	9��(�(��g�y�$�)0�(�K�)1�3C�)7�
9�
9�
9�
9�
9�	9�	9rc���|j���|_|j���|_|jjj|_|jjj|_	dSr)
r}r�r�r�rG�sendr�rP�recvr�r#s rr~zPool._setup_queuesYsN���	�-�-�/�/��
���.�.�0�0����-�/�4����.�0�5����rc�D�|jtkrtd���dS)NzPool not running)r|rr�r#s r�_check_runningzPool._check_running_s&���;�#����/�0�0�0��rc�V�	|�|||�����Sr)�apply_asyncrM)r rarrbs    r�applyz
Pool.applycs-��	�����d�D�1�1�5�5�7�7�7rc�b�	|�||t|�����Sr)�
_map_asyncrrM�r ra�iterable�	chunksizes    rrzPool.mapjs-��	����t�X�w�	�B�B�F�F�H�H�Hrc�b�	|�||t|�����Sr)r�rrMr�s    rrzPool.starmapqs-��	�
���t�X�{�I�F�F�J�J�L�L�Lrc�B�	|�||t|||��Sr)r�r�r rar�r��callback�error_callbacks      r�
starmap_asynczPool.starmap_asyncys,��	����t�X�{�I�'��9�9�	9rc#�K�		d}t|��D]\}}||||fifV��dS#t$r}||dzt|fifV�Yd}~dSd}~wwxYw)N���r)�	enumeraterTrU)r �
result_jobrar�r`�xrds       r�_guarded_task_generationzPool._guarded_task_generation�s�����	�	J��A�!�(�+�+�
6�
6���1�!�1�d�Q�D�"�5�5�5�5�5�
6�
6���	J�	J�	J��q��s�$>���b�I�I�I�I�I�I�I�I�I�I�����	J���s�!(�
A�A
�
Arc��	|���|dkrLt|��}|j�|�|j||��|jf��|S|dkr"td�|�����t�
|||��}t|��}|j�|�|jt|��|jf��d�|D��S)NrzChunksize must be 1+, not {0:n}c3�$K�|]}|D]}|V���dSrr(�r��chunkrps   r�	<genexpr>zPool.imap.<locals>.<genexpr>��/����?�?�U��?�?��D�?�?�?�?�?�?�?r)r��IMapIteratorr�rLr��_job�_set_lengthr�rKr�
_get_tasksr�r rar�r�rc�task_batchess      r�imapz	Pool.imap�s&��	�	
��������>�>�!�$�'�'�F��O����1�1�&�+�t�X�N�N��&��
�
�
�
�M��1�}�}� �5�<�<�!�#�#�$�$�$� �?�?�4��9�E�E�L�!�$�'�'�F��O����1�1�&�+�29�2>�@�@��&�	�
�
�
�@�?�f�?�?�?�?rc��	|���|dkrLt|��}|j�|�|j||��|jf��|S|dkr"td�|�����t�
|||��}t|��}|j�|�|jt|��|jf��d�|D��S)NrzChunksize must be 1+, not {0!r}c3�$K�|]}|D]}|V���dSrr(r�s   rr�z&Pool.imap_unordered.<locals>.<genexpr>�r�r)r��IMapUnorderedIteratorr�rLr�r�r�r�rKrr�rr�s      r�imap_unorderedzPool.imap_unordered�s"��	�	
��������>�>�*�4�0�0�F��O����1�1�&�+�t�X�N�N��&��
�
�
�
�M��1�}�}� �5�<�<�Y�G�G�I�I�I��?�?�4��9�E�E�L�*�4�0�0�F��O����1�1�&�+�29�2>�@�@��&�	�
�
�
�@�?�f�?�?�?�?rc��	|���t|||��}|j�|jd|||fgdf��|S�Nr)r��ApplyResultr�rLr�)r rarrbr�r�rcs       rr�zPool.apply_async�s\��	�	
�������T�8�^�<�<������v�{�A�t�T�4�@�A�4�H�I�I�I��
rc�B�	|�||t|||��Sr)r�rr�s      r�	map_asynczPool.map_async�s,��	����t�X�w�	�8����	rc��	|���t|d��st|��}|�<tt	|��t	|j��dz��\}}|r|dz
}t	|��dkrd}t�|||��}t||t	|��||���}	|j	�
|�|	j||��df��|	S)N�__len__�rr�r�)
r�rNr�divmodr�r{rr��	MapResultr�rLr�r�)
r rar��mapperr�r�r��extrar�rcs
          rr�zPool._map_async�s��	�	
�������x��+�+�	&��H�~�~�H���%�c�(�m�m�S���_�_�q�5H�I�I��I�u��
��Q��	��x�=�=�A����I����t�X�y�A�A���4��C��M�M�8�*8�:�:�:�������-�-�f�k�.4�.:�<�<��	
�	
�	
�	
��
rc��t||���|���s*|���|����(dSdS)N)�timeout)r	�emptyrM)r��change_notifierrs   r�_wait_for_updateszPool._wait_for_updates�se���Y��(�(�(�(�!�'�'�)�)�	"����!�!�!�"�'�'�)�)�	"�	"�	"�	"�	"rc��tj��}|jtks|r|jtkro|�|||||||	|
||�
�
g|�|���|
�}|�||��|jtk�]|r|jtk�o|�d��tj
d��dS)Nzworker handler exiting)r��current_threadr|rr
r�r�r	rLrrS)r��cache�	taskqueuerurtr�r�rWrXrYrZr�r\r�r�thread�current_sentinelss                 rr�zPool._handle_workers�s���
�)�+�+���m�s�"�"�u�"���)�1K�1K����s�G�Y��g�'��h�/��
A�
A�
A�!O�#�";�";�D�"A�"A� N�I� N���!�!�"3�_�E�E�E��m�s�"�"�u�"���)�1K�1K�	�
�
�d�����
�+�,�,�,�,�,rc�J�tj��}t|jd��D]�\}}d}	|D]�}|jt
krt
jd��n�	||���5#t$rG}	|dd�\}
}	||
�	|d|	f��n#t$rYnwxYwYd}	~	��d}	~	wwxYw|r.t
jd��|r|dnd}||dz��	dx}x}}
��	dx}x}}
n#dx}x}}
wxYwt
jd��	t
jd��|�d��t
jd	��|D]
}|d���n$#t$rt
jd
��YnwxYwt
jd��dS)Nz'task handler found thread._state != RUN�Fzdoing set_length()rr�ztask handler got sentinelz/task handler sending sentinel to result handlerz(task handler sending sentinel to workersz/task handler got OSError when sending sentinelsztask handler exiting)
r�r�iterrMr|rrrSrT�_set�KeyErrorrLrR)
r
rLrXr�rr�taskseq�
set_lengthr^rdr_�idxr�s
             rr�zPool._handle_taskssB���)�+�+��#'�	�
�t�#<�#<�	4�	4��G�Z��D�
,�#���D��}��+�+��
�#L�M�M�M���!���D�	�	�	�	��$�!�!�!�#'����8���S�!�!�#�J�O�O�C�%���<�<�<�<��'�!�!�!� �D�!�������������	!����"�,��
�#7�8�8�8�)-�5�d�1�g�g�2��"�
�3��7�+�+�+��(,�+��+�w����'+�+��+�w�����t�+��+�w��+�+�+�+��J�2�3�3�3�
	J��J�H�I�I�I��L�L�����
�J�A�B�B�B��
�
����D�	�	�	�	�
���	J�	J�	J��J�H�I�I�I�I�I�	J����	
�
�)�*�*�*�*�*sl�*C=�A(�'C=�(
B9�2
B4�B�B4�
B,	�)B4�+B,	�,B4�/C=�4B9�93C=�=D�A
E+�+F�Fc��tj��}		|��}n,#ttf$rt	jd��YdSwxYw|jtkrt	jd��nR|�t	jd��n;|\}}}	||�||��n#t$rYnwxYwdx}x}}��|r�|jtkr�	|��}n,#ttf$rt	jd��YdSwxYw|�t	jd���a|\}}}	||�||��n#t$rYnwxYwdx}x}}|r|jtk��t|d��rdt	jd��	td��D]'}|j
���sn|���(n#ttf$rYnwxYwt	jd	t|��|j��dS)
Nrz.result handler got EOFError/OSError -- exitingz,result handler found thread._state=TERMINATEzresult handler got sentinelz&result handler ignoring extra sentinelrPz"ensuring that outqueue is not full�
z7result handler exiting: len(cache)=%s, thread._state=%s)r�rrRrQrrSr|rrrr
rNr�rP�pollr�)rXrMrrr^r_r`�objs        rr�zPool._handle_results=s����)�+�+��	$�
��s�u�u�����X�&�
�
�
��
�K�L�L�L����
�����}��#�#��
�I�J�J�J���|��
�8�9�9�9���K�C��C�
��c�
����3�'�'�'�'���
�
�
���
����#�#�D�#�3��+	$�.�	$��
��2�2�
��s�u�u�����X�&�
�
�
��
�K�L�L�L����
�����|��
�C�D�D�D���K�C��C�
��c�
����3�'�'�'�'���
�
�
���
����#�#�D�#�3���	$��
��2�2�"�8�Y�'�'�	��J�;�<�<�<�
��r�����A�#�+�0�0�2�2�����C�E�E�E�E����X�&�
�
�
���
����	
�
�L��%�j�j�&�-�	)�	)�	)�	)�	)sW�
!�%A
�	A
�B-�-
B:�9B:�
C"�"%D�
D�,E	�	
E�E�7G�G"�!G"c#�K�t|��}	ttj||����}|sdS||fV��-r)r�tupler�islice)ra�it�sizer�s    rr�zPool._get_tasksysO����
�"�X�X��	��i�&�r�4�0�0�1�1�A��
�����)�O�O�O�		rc� �td���)Nz:pool objects cannot be passed between processes or pickled)�NotImplementedErrorr#s rr4zPool.__reduce__�s��!�J���	rc��tjd��|jtkr9t|_t|j_|j�d��dSdS)Nzclosing pool)rrSr|rrr�r�rLr#s rrOz
Pool.close�sV���
�>�"�"�"��;�#����D�K�*/�D� �'��!�%�%�d�+�+�+�+�+��rc�n�tjd��t|_|���dS)Nzterminating pool)rrSr
r|r�r#s rr�zPool.terminate�s0���
�%�&�&�&�����������rc��tjd��|jtkrt	d���|jt
tfvrt	d���|j���|j	���|j
���|jD]}|����dS)Nzjoining poolzPool is still runningzIn unknown state)rrSr|rr�rr
r�r0r�r�r{)r r�s  rr0z	Pool.join�s����
�>�"�"�"��;�#����4�5�5�5�
�[��	� 2�
2�
2��/�0�0�0���!�!�#�#�#�����!�!�!���!�!�#�#�#���	�	�A�
�F�F�H�H�H�H�	�	rc�z�tjd��|j���|���ru|j���r`|j���tj	d��|���r|j����ZdSdSdSdS)Nz7removing tasks from inqueue until task handler finishedr)
rrS�_rlock�acquire�is_aliverPrr��time�sleep)rW�task_handlerr s   r�_help_stuff_finishzPool._help_stuff_finish�s���	
�
�L�M�M�M����� � � ��#�#�%�%�	�'�/�*>�*>�*@�*@�	��O� � �"�"�"��J�q�M�M�M��#�#�%�%�	�'�/�*>�*>�*@�*@�	�	�	�	�	�	�	�	�	rc
���tjd��t|_|�d��t|_tjd��|�||t
|����|���s"t
|	��dkrtd���t|_|�d��|�d��tjd��tj
��|ur|���|rJt|dd��r4tjd��|D]}
|
j
�|
����tjd��tj
��|ur|���tjd	��tj
��|ur|���|rst|dd��r_tjd
��|D]J}
|
���r0tjd|
jz��|
����GdSdSdS)Nzfinalizing poolz&helping task handler/workers to finishrz.Cannot have cache with result_hander not alivezjoining worker handlerr�zterminating workerszjoining task handlerzjoining result handlerzjoining pool workersr�)rrSr
r|rLr-r�r)rJr�rr0rNr�r��pid)r�r
rWrXr�r�worker_handlerr,�result_handlerrr�s           rr�zPool._terminate_pool�sb��	
�
�$�%�%�%�
!*������D�!�!�!�'����
�;�<�<�<����w��c�$�i�i�@�@�@��'�'�)�)�	B��E�
�
�a��� �@�B�B�
B�!*������D�!�!�!����T����	
�
�+�,�,�,��#�%�%�^�;�;����!�!�!��	"�G�D��G�[�1�1�	"��J�,�-�-�-��
"�
"���:�%��K�K�M�M�M���
�)�*�*�*��#�%�%�\�9�9��������
�+�,�,�,��#�%�%�^�;�;����!�!�!��	�G�D��G�[�1�1�	��J�-�.�.�.��
�
���:�:�<�<���J�6���>�?�?�?��F�F�H�H�H��
	�	�	�	�
�
rc�.�|���|Sr)r�r#s r�	__enter__zPool.__enter__�s���������rc�.�|���dSr)r�)r �exc_type�exc_val�exc_tbs    r�__exit__z
Pool.__exit__�s���������r)NNr(NNr)NNN)r),r%r&r'r��staticmethodrtr!�warnings�warnrr�rCr�r�r�r�r�r�r~r�r�rrr�r�r�r�r�r�r�r	�classmethodr�r�r�r�r4rOr�r0r-r�r3r8r(rrrr�s\��������O��*�*��\�*�CE�04�O�O�O�O�f%�M�s�0�0�0�0�1�1�1�A�A�A�
�8�8��\�8��
�
��\�
�B�B�B��'�'��\�'�$�	9�	9��\�	9�6�6�6�1�1�1� "��8�8�8�8�I�I�I�I�M�M�M�M�FJ��9�9�9�9�	J�	J�	J�@�@�@�@�:@�@�@�@�8&(�b�4������BF������KO������:�"�"�"��\�"�
�-�-��[�-�(�++�++��\�++�Z�9)�9)��\�9)�v����\�����
,�,�,����

�
�
�����\���3�3��[�3�j�������rc�V�eZdZd�Zd�Zd�Zdd�Zdd�Zd�Ze	e
j��ZdS)	r�c���||_tj��|_t	t
��|_|j|_||_||_	||j|j<dSr)
r{r��Event�_event�next�job_counterr�r��	_callback�_error_callback)r r�r�r�s    rr!zApplyResult.__init__�sS����
��o�'�'�����%�%��	��k���!���-���!%���D�I���rc�4�|j���Sr)r@�is_setr#s r�readyzApplyResult.ready�s���{�!�!�#�#�#rc�|�|���s"td�|�����|jS)Nz{0!r} not ready)rGr�rK�_successr#s r�
successfulzApplyResult.successful�s7���z�z�|�|�	=��.�5�5�d�;�;�<�<�<��}�rNc�:�|j�|��dSr)r@r	�r rs  rr	zApplyResult.wait�s�������!�!�!�!�!rc��|�|��|���st�|jr|jS|j�r)r	rGrrI�_valuerLs  rrMzApplyResult.get�sD���	�	�'�����z�z�|�|�	����=�	��;���+�rc��|\|_|_|jr!|jr|�|j��|jr!|js|�|j��|j���|j|j=d|_dSr)	rIrNrCrDr@�setr�r�r{�r r`rs   rrzApplyResult._sets���%(�"��
�t�{��>�	(�d�m�	(��N�N�4�;�'�'�'���	.��
�	.�� � ���-�-�-���������K��	�"���
�
�
rr)
r%r&r'r!rGrJr	rMrr<�types�GenericAlias�__class_getitem__r(rrr�r��s�������&�&�&�$�$�$����
"�"�"�"��������$��E�$6�7�7���rr�c��eZdZd�Zd�ZdS)rc��t�||||���d|_dg|z|_||_|dkr/d|_|j���|j|j	=dS||zt||z��z|_dS)NrTr)r�r!rIrN�
_chunksize�_number_leftr@rPr�r��bool)r r�r��lengthr�r�s      rr!zMapResult.__init__s������T�4��,:�	�	<�	<�	<���
��f�v�o���#�����>�>� !�D���K�O�O������D�I�&�&�&� &�	� 1�D��)�9K�4L�4L� L�D���rc��|xjdzc_|\}}|r�|jr|||j||jz|dz|jz�<|jdkrP|jr|�|j��|j|j=|j���d|_	dSdS|s|jrd|_||_|jdkrP|j
r|�
|j��|j|j=|j���d|_	dSdS)NrrF)rXrIrNrWrCr�r�r@rPr{rD)r r`�success_result�successrcs     rrzMapResult._set)s1�����Q����(�����	"�t�}�	"�CI�D�K��$�/�)�1�Q�3���*?�?�@�� �A�%�%��>�0��N�N�4�;�/�/�/��K��	�*�����!�!�!�!��
�
�
�&�%��
%�t�}�
%� %��
�$���� �A�%�%��'�6��(�(���5�5�5��K��	�*�����!�!�!�!��
�
�
�
&�%rN)r%r&r'r!rr(rrrrs5������M�M�M�"�"�"�"�"rrc�2�eZdZd�Zd�Zdd�ZeZd�Zd�ZdS)r�c�*�||_tjtj����|_tt��|_|j|_tj
��|_d|_d|_
i|_||j|j<dSr�)r{r��	Condition�Lock�_condrArBr�r��collections�deque�_items�_index�_length�	_unsorted)r r�s  rr!zIMapIterator.__init__Gst����
��(���)9�)9�:�:��
���%�%��	��k���!�'�)�)������������!%���D�I���rc��|Srr(r#s r�__iter__zIMapIterator.__iter__Rs���rNc��|j5	|j���}n�#t$r�|j|jkrd|_td�|j�|��	|j���}n5#t$r(|j|jkrd|_td�td�wxYwYnwxYwddd��n#1swxYwY|\}}|r|S|�r)
rbre�popleft�
IndexErrorrfrgr{�
StopIterationr	r)r rrpr]r;s     rrAzIMapIterator.nextUsE��
�Z�	1�	1�

1��{�*�*�,�,�����
1�
1�
1��;�$�,�.�.�!%�D�J�'�T�1��
����(�(�(�1��;�.�.�0�0�D�D��!�1�1�1��{�d�l�2�2�%)��
�+��5�&�D�0�	1�����D�

1����	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1� �����	��L��sJ�C	�$�C	�AB:�(B�B:�2B4�4B:�7C	�9B:�:C	�	C
�C
c�
�|j5|j|kr�|j�|��|xjdz
c_|j|jvrW|j�|j��}|j�|��|xjdz
c_|j|jv�W|j���n
||j|<|j|jkr|j|j	=d|_
ddd��dS#1swxYwYdS�Nr)rbrfrer�rh�pop�notifyrgr�r�r{rQs   rrzIMapIterator._setmsE��
�Z�	"�	"��{�a�����"�"�3�'�'�'����q� ����k�T�^�3�3��.�,�,�T�[�9�9�C��K�&�&�s�+�+�+��K�K�1�$�K�K��k�T�^�3�3��
�!�!�#�#�#�#�$'���q�!��{�d�l�*�*��K��	�*�!��
�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�C#C8�8C<�?C<c���|j5||_|j|jkr-|j���|j|j=d|_ddd��dS#1swxYwYdSr)rbrgrfrrr�r�r{)r rZs  rr�zIMapIterator._set_length~s���
�Z�	"�	"�!�D�L��{�d�l�*�*��
�!�!�#�#�#��K��	�*�!��
�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�AA�A�!Ar)	r%r&r'r!rjrA�__next__rr�r(rrr�r�Esk������	&�	&�	&��������,�H�"�"�"�""�"�"�"�"rr�c��eZdZd�ZdS)r�c��|j5|j�|��|xjdz
c_|j���|j|jkr|j|j=d|_ddd��dS#1swxYwYdSrp)	rbrer�rfrrrgr�r�r{rQs   rrzIMapUnorderedIterator._set�s���
�Z�	"�	"��K���s�#�#�#��K�K�1��K�K��J�������{�d�l�*�*��K��	�*�!��
�
	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�A(A=�=B�BN)r%r&r'rr(rrr�r��s#������"�"�"�"�"rr�c�n�eZdZdZed���Zdd�Zd�Zd�Zed���Z	ed	���Z
d
�ZdS)rFc��ddlm}||i|��S)Nrrs)�dummyrt)rurrbrts    rrtzThreadPool.Process�s)��"�"�"�"�"�"��w��%��%�%�%rNr(c�@�t�||||��dSr)rr!)r r�rYrZs    rr!zThreadPool.__init__�s ���
�
�d�I�{�H�=�=�=�=�=rc��tj��|_tj��|_|jj|_|jj|_dSr)rr�r�r�rLr�rMr�r#s rr~zThreadPool._setup_queues�s>���)�+�+��
��*�,�,����-�+����.�,����rc��|jjgSr)r�rPr#s rr�zThreadPool._get_sentinels�s���%�-�.�.rc��gSrr(r�s rr�z ThreadPool._get_worker_sentinels�s���	rc��		|�d����#tj$rYnwxYwt|��D]}|�d���dS)NTF)�block)rMr�Emptyr�rL)rWr,r r`s    rr-zThreadPool._help_stuff_finish�s{��	�
)����%��(�(�(�
)���{�	�	�	��D�	�����t���	�	�A��K�K������	�	s��,�,c�.�tj|��dSr)r*r+)r r�rrs    rr	zThreadPool._wait_for_updates�s���
�7�����r)NNr()r%r&r'r�r9rtr!r~r�r�r-r	r(rrrr�s��������O��&�&��\�&�>�>�>�>�-�-�-�/�/�/�����\������\������r)Nr(NF))�__all__rcrr�rr�r*r-rRr:r,rrr�
connectionr	r
rrr
�countrBrrrTrr*r3r8rfrU�dictrj�objectrr��AsyncResultrr�r�rr(rr�<module>r�s����<�
 ����������	�	�	�	�������������������������������'�'�'�'�'�'�'�'��������������	��i�o�������5�5�5������i����0�0�0�0�0�0�0�0����<�<�<�<�<��<�<�<�"GK��+<�+<�+<�+<�Z
�
�
�$�$�$�$�$��$�$�$�.v�v�v�v�v�6�v�v�v�x)8�)8�)8�)8�)8�&�)8�)8�)8�V��%"�%"�%"�%"�%"��%"�%"�%"�V?"�?"�?"�?"�?"�6�?"�?"�?"�J	"�	"�	"�	"�	"�L�	"�	"�	"�$�$�$�$�$��$�$�$�$�$r