Your IP : 3.147.140.101


Current Path : /opt/alt/python313/lib64/python3.13/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/multiprocessing/__pycache__/pool.cpython-313.pyc

�

+}g����SS/rSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr SSK
JrJ
r
 SSKJr SrS	rS
rSr\R("5rSrS
r"SS\5r"SS5rSr"SS\5rS#SjrSr"SS\5r "SS\!5r""SS\!5r#\#r$"SS\#5r%"SS\!5r&"S S!\&5r'"S"S\"5r(g)$�Pool�
ThreadPool�N�)�util)�get_context�TimeoutError)�wait�INIT�RUN�CLOSE�	TERMINATEc�$�[[U65$�N)�list�map��argss �;/opt/alt/python313/lib64/python3.13/multiprocessing/pool.py�mapstarr/s����T�
���c�N�[[R"USUS55$)Nrr)r�	itertools�starmaprs r�starmapstarr2s"���	�!�!�$�q�'�4��7�3�4�4rc� �\rSrSrSrSrSrg)�RemoteTraceback�9c��Xlgr��tb)�selfr s  r�__init__�RemoteTraceback.__init__:s���rc��UR$rr�r!s r�__str__�RemoteTraceback.__str__<s���w�w�rrN)�__name__�
__module__�__qualname__�__firstlineno__r"r&�__static_attributes__�rrrr9s���rrc� �\rSrSrSrSrSrg)�ExceptionWithTraceback�?c��[R"[U5X5nSRU5nXlSU-Ulg)N�z

"""
%s""")�	traceback�format_exception�type�join�excr )r!r7r s   rr"�ExceptionWithTraceback.__init__@s6��
�
'�
'��S�	�3�
;��
�W�W�R�[���� �2�%��rc�>�[URUR44$r)�rebuild_excr7r r%s r�
__reduce__�!ExceptionWithTraceback.__reduce__Es���T�X�X�t�w�w�/�/�/r�r7r N)r(r)r*r+r"r;r,r-rrr/r/?s��&�
0rr/c�&�[U5UlU$r)r�	__cause__r=s  rr:r:Hs��#�B�'�C�M��Jrc�8^�\rSrSrSrU4SjrSrSrSrU=r	$)�MaybeEncodingError�PzRWraps possible unpickleable errors, so they can be
safely sent through the socket.c�>�[U5Ul[U5Ul[[U]URUR5 gr)�reprr7�value�superrAr")r!r7rE�	__class__s   �rr"�MaybeEncodingError.__init__Ts3�����9����%�[��
�
� �$�0����4�:�:�Frc�@�SUR<SUR<S3$)NzError sending result: 'z'. Reason: '�')rEr7r%s rr&�MaybeEncodingError.__str__Ys��=A�Z�Z�=A�X�X�G�	Grc�@�SURR<SU<S3$)N�<z: �>)rGr(r%s r�__repr__�MaybeEncodingError.__repr__]s��!�^�^�4�4�d�;�;r)r7rE)
r(r)r*r+�__doc__r"r&rOr,�
__classcell__�rGs@rrArAPs���'�G�
G�<�<rrAc���Ub5[U[5(aUS:�d[SRU55eURnUR
n[
US5(a4URR5 URR5 UbU"U6 SnUbU(afX�:aaU"5n	U	c[R"S5 O?U	up�p�nSU"U
0UD64nU"X�U45 S=n	=n
=n=n=p�US-
nUcMSU(aX�:aMa[R"S
U-5 g![[4a [R"S5 MCf=f![a4nU(aU[La[!UUR"5nSU4nSnAN�SnAff=f![a>n[%UUS5n[R"S	U-5 U"X�SU445 SnAN�SnAff=f)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�hasattrrU�close�_reader�EOFError�OSErrorr�debug�	Exception�_helper_reraises_exceptionr/�
__traceback__rA)�inqueue�outqueue�initializer�initargs�maxtasks�wrap_exceptionrZr[�	completed�task�job�i�funcr�kwds�result�e�wrappeds                  r�workerrtas�����z�(�C�'@�'@�+3�q�=��9�@�@��J�K�K�
�,�,�C�
�+�+�C��w�	�"�"������������ ����X���I�
�
�x�I�,@�	��5�D�
�<��J�J�7�8��#'� ���D�	 ��D�$�/�$�/�0�F�
	,���� �!�48�7��7�s�7�V�7�d�7�T��Q��	�7�
�x�I�,@�8	�J�J�.��:�;��3�'�"�	��J�J�B�C��	���	 ��$�.H�"H�*�1�a�o�o�>���Q�Z�F��	 ���	,�(��F�1�I�6�G��J�J�I���
���%��)�*�+�+��		,�sB�0D*�
E�#
F�*&E�E�
F�!*F�F�
G �"4G�G c��Ue)z@Pickle-able helper function for use by _guarded_task_generation.r-)�exs rrcrc�s��
�Hrc�@^�\rSrSrSrSS.U4SjjrU4SjrSrU=r$)�
_PoolCache�z�
Class that implements a cache for the Pool class that will notify
the pool management threads every time the cache is emptied. The
notification is done by the use of a queue that is provided when
instantiating the cache.
N��notifierc�2>�Xl[TU]"U0UD6 gr)r{rFr")r!r{rrprGs    �rr"�_PoolCache.__init__�s��� �
�
���$�'�$�'rc�j>�[TU]U5 U(dURRS5 ggr)rF�__delitem__r{rZ)r!�itemrGs  �rr�_PoolCache.__delitem__�s,���
���D�!���M�M���d�#�r)	r(r)r*r+rQr"rr,rRrSs@rrxrx�s!����+/�(�(�
$�
$rrxc���\rSrSrSrSr\S5rS*Sjr\	R\4SjrS	r
S
r\S5r\S5rS
r\S5r\S5rSrSrS04SjrS+SjrS+SjrS,SjrSrS-SjrS-SjrS0SS4SjrS,SjrS,Sjr\S+Sj5r \!S5r"\S5r#\S5r$\S 5r%S!r&S"r'S#r(S$r)\S%5r*\!S&5r+S'r,S(r-S)r.g).r�zK
Class which supports an async version of applying functions to arguments.
Tc�&�UR"U0UD6$r��Process)�ctxrrps   rr��Pool.Process�s���{�{�D�)�D�)�)rNr-c��/Ul[UlU=(d
 [5UlUR5 [R"5UlURR5Ul	[URS9UlX@lX l
X0lUc[R "5=(d SnUS:a[#S5eUb&[%U[&5(aUS::a[#S5eUb[)U5(d[+S5eXlUR/5 UR95n[:R<"[>R@URURURURBUR,URURDURFURURURURHXpR4S9Ul%SURJl&[NURJlURJRQ5 [:R<"[>RRURURTURFURUR4S9Ul+SURVl&[NURVlURVRQ5 [:R<"[>RXURFURZUR4S9Ul.SUR\l&[NUR\lUR\RQ5 [^R`"XRbURURDURFURURURJURVUR\UR4	S	S
9Ul2[NUlg![0aW URH"nUR2bMUR55 M$ URHnUR75 M ef=f)Nrzrz&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_notifierrx�_cache�_maxtasksperchild�_initializer�	_initargs�os�process_cpu_count�
ValueErrorrVrW�callable�	TypeError�
_processes�_repopulate_poolrb�exitcode�	terminater6�_get_sentinels�	threading�Threadr�_handle_workersr��_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!�	processesrgrh�maxtasksperchild�context�p�	sentinelss        rr"�
Pool.__init__�sI����
�����,�{�}��	������+�+�-���!%�	�	� 5� 5� 7��� �$�*?�*?�@���!1��'��!�����,�,�.�3�!�I��q�=��E�F�F��'��.��4�4�8H�A�8M� �!R�S�S��"�8�K�+@�+@��<�=�=�#��	��!�!�#��'�'�)�	�(�/�/��'�'��+�+�t����	�	�4�<�<��/�/�4�:�:�t�}�}�d�n�n��#�#�T�^�^�T�5K�5K��&�&�	�3H�3H�J� ���'+����#�&)����#����"�"�$�'�-�-��%�%��/�/�4�?�?�D�N�N��*�*�d�k�k�+����
%)����!�$'����!���� � �"�(�/�/��'�'��.�.�$�/�/�4�;�;�?� ���'+����#�&)����#����"�"�$��-�-��&�&��/�/�4�=�=�$�.�.�$�*�*��'�'��)=�)=�t�?Q�?Q��&�&����5���������]�	��Z�Z���:�:�%��K�K�M� ��Z�Z������ ��
	�s�O1�1$Q�9Qc��URU:Xa;U"SU<3[US9 [USS5bURR	S5 ggg)Nz&unclosed running multiprocessing pool )�sourcer�)r��ResourceWarning�getattrr�rZ)r!�_warnrs   r�__del__�Pool.__del__
sT���;�;�#���:�4�(�C�!�$�
0��t�/��6�B��%�%�)�)�$�/�C�rc
��URnSURSURSURS[	UR
5S3	$)NrM�.z state=z pool_size=rN)rGr)r*r��lenr�)r!�clss  rrO�
Pool.__repr__sQ���n�n���C�N�N�#�1�S�%5�%5�$6�7����
�&� ����_�-�Q�0�	1rc�j�URR/nURR/n/UQUQ$r)r�r^r�)r!�task_queue_sentinels�self_notifier_sentinelss   rr��Pool._get_sentinelss<�� $��� 6� 6�7��#'�#8�#8�#@�#@�"A��@�%�@�(?�@�@rc�l�UVs/sH"n[US5(dMURPM$ sn$s snf)N�sentinel)r\r�)�workersrts  r�_get_worker_sentinels�Pool._get_worker_sentinelss<���8��%+�"�6�:�6� �����8�	8��8s�1�1c���Sn[[[U555HCnXnURcM[R
"SU-5 UR
5 SnX	ME U$)z�Cleanup after any worker processes which have exited due to reaching
their specified lifetime.  Returns True if any workers were cleaned up.
F�cleaning up worker %dT)�reversed�ranger�r�rrar6)�pool�cleanedrnrts    r�_join_exited_workers�Pool._join_exited_workers!s^��
���%��D�	�*�+�A��W�F����*��
�
�2�Q�6�7����
����G�,��rc��URURURURURUR
URURURURUR5
$r)�_repopulate_pool_staticr�r�r�r�r�r�r�r�r�r�r%s rr��Pool._repopulate_pool1s_���+�+�D�I�I�t�|�|�,0�O�O�,0�J�J��
�
�,0�N�N�D�<M�<M�,0�N�N�,0�,B�,B�,0�,@�,@�
B�	Brc
��[U[U5-
5Hrn
U"U[XEUXxU	4S9nURR	SS5UlSUlUR
5 URU5 [R"S5 Mt g)zpBring the number of pool processes up to the specified number,
for use after reaping workers which have exited.
r�r��
PoolWorkerTzadded workerN)
r�r�rt�name�replacer�r��appendrra)r�r�r�r�rerfrgrhr�rjrn�ws            rr��Pool._repopulate_pool_static:sz���y�3�t�9�,�-�A���F�%�)�&�,�.�/�A�
�V�V�^�^�I�|�<�A�F��A�H�
�G�G�I��K�K��N��J�J�~�&�.rc
�n�[RU5(aXX#XEUXxU	5
 gg)zEClean up any exited workers and start replacements for them.
        N)rr�r�)
r�r�r�r�rerfrgrhr�rjs
          r�_maintain_pool�Pool._maintain_poolMs7���$�$�T�*�*��(�(��y�)0�K�)1�)7�
9�+rc��URR5UlURR5UlURRR
UlURRRUl	gr)
r�r�r�r�rU�sendr�r^�recvr�r%s rr��Pool._setup_queuesYsX���	�	�-�-�/��
����.�.�0����-�-�/�/�4�4����.�.�0�0�5�5��rc�B�UR[:wa[S5eg)NzPool not running)r�rr�r%s r�_check_running�Pool._check_running_s���;�;�#���/�0�0�rc�B�URXU5R5$)z<
Equivalent of `func(*args, **kwds)`.
Pool must be running.
)�apply_asyncr[)r!rorrps    r�apply�
Pool.applycs ��
����D�1�5�5�7�7rc�L�URX[U5R5$)z`
Apply `func` to each element in `iterable`, collecting the results
in a list that is returned.
)�
_map_asyncrr[�r!ro�iterable�	chunksizes    rr�Pool.mapjs ��
���t�w�	�B�F�F�H�Hrc�L�URX[U5R5$)z�
Like `map()` method but the elements of the `iterable` are expected to
be iterables as well and will be unpacked as arguments. Hence
`func` and (a, b) becomes func(a, b).
)r�rr[r�s    rr�Pool.starmapqs �����t�{�I�F�J�J�L�Lrc�2�URX[UXE5$)z-
Asynchronous version of `starmap()` method.
)r�r�r!ror�r��callback�error_callbacks      r�
starmap_async�Pool.starmap_asyncys��
���t�{�I�'�9�	9rc#�# �Sn[U5H
upEXX%404v� M g![anUWS-[U404v� SnAgSnAff=f7f)z�Provides a generator of tasks for imap and imap_unordered with
appropriate handling for iterables which throw exceptions during
iteration.���rN)�	enumeraterbrc)r!�
result_jobror�rn�xrrs       r�_guarded_task_generation�Pool._guarded_task_generation�sY���	J��A�!�(�+���!�d�D�"�5�5�,���	J��q��s�$>���b�I�I��	J�s)�A�#�A�
A�A�A�A�Ac���UR5 US:XaN[U5nURRUR	UR
X5UR45 U$US:a[SRU55e[RXU5n[U5nURRUR	UR
[U5UR45 SU5$)z@
Equivalent of `map()` -- can be MUCH slower than `Pool.map()`.
rzChunksize must be 1+, not {0:n}c3�6# �UHoHo"v� M M g7frr-��.0�chunkr�s   r�	<genexpr>�Pool.imap.<locals>.<genexpr>�����?�f�U���D��D�f���)r��IMapIteratorr�rZr�_job�_set_lengthr�rYr�
_get_tasksr�r!ror�r�rq�task_batchess      r�imap�	Pool.imap�s���	
������>�!�$�'�F��O�O����1�1�&�+�+�t�N��&�&��
�
�M��1�}� �5�<�<�!�#�$�$� �?�?�4�9�E�L�!�$�'�F��O�O����1�1�&�+�+�29�2>�@��&�&�	�
�@�f�?�?rc���UR5 US:XaN[U5nURRUR	UR
X5UR45 U$US:a[SRU55e[RXU5n[U5nURRUR	UR
[U5UR45 SU5$)z<
Like `imap()` method but ordering of results is arbitrary.
rzChunksize must be 1+, not {0!r}c3�6# �UHoHo"v� M M g7frr-rs   rr�&Pool.imap_unordered.<locals>.<genexpr>�r
r)r��IMapUnorderedIteratorr�rZrrrr�rYrrrrs      r�imap_unordered�Pool.imap_unordered�s���	
������>�*�4�0�F��O�O����1�1�&�+�+�t�N��&�&��
�
�M��1�}� �5�<�<�Y�G�I�I��?�?�4�9�E�L�*�4�0�F��O�O����1�1�&�+�+�29�2>�@��&�&�	�
�@�f�?�?rc��UR5 [XU5nURRURSXU4/S45 U$)z+
Asynchronous version of `apply()` method.
rN)r��ApplyResultr�rZr)r!rorrpr�r�rqs       rr��Pool.apply_async�sH��
	
�����T�^�<�������v�{�{�A�t�4�@�A�4�H�I��
rc�2�URX[X4U5$)z)
Asynchronous version of `map()` method.
)r�rr�s      r�	map_async�Pool.map_async�s��
���t�w�	���	rc��UR5 [US5(d[U5nUc9[[	U5[	UR
5S-5upGU(aUS-
n[	U5S:XaSn[RXU5n[X[	U5UUS9n	URRURU	RUU5S45 U	$)zI
Helper function to implement map, starmap and their async counterparts.
�__len__N�rr�r�)
r�r\r�divmodr�r�rr�	MapResultr�rZrr)
r!ror��mapperr�r�r��extrarrqs
          rr��Pool._map_async�s���
	
�����x��+�+��H�~�H���%�c�(�m�S����_�q�5H�I��I���Q��	��x�=�A���I����t�y�A���4�C��M�8�*8�:��������-�-�f�k�k�.4�.:�<��	
�	
��
rc��[XS9 UR5(d(UR5 UR5(dM'gg)N)�timeout)r	�emptyr[)r��change_notifierr-s   r�_wait_for_updates�Pool._wait_for_updates�s6���Y�(�!�'�'�)�)����!�"�'�'�)�)rc��[R"5nUR[:XdU(a�UR[:wapURX4XVUX�U
X�5
 /UR
U5QU
QnURUU5 UR[:XaMSU(aUR[:waMpURS5 [R"S5 g)Nzworker handler exiting)r��current_threadr�rr
r�r�r0rZrra)r��cache�	taskqueuer�r�r�r�rerfrgrhr�rjr�r/�thread�current_sentinelss                 rr��Pool._handle_workers�s���
�)�)�+���m�m�s�"�u����)�1K����s�Y�g�'�h�/�
A�!O�#�";�";�D�"A� N�I� N���!�!�"3�_�E��m�m�s�"�u����)�1K�	�
�
�d���
�
�+�,rc�f�[R"5n[URS5H�upgSnUH8nUR[
:wa[R"S5  OKU"U5 M: U(a/[R"S5 U(aUSOSnU"US-5 S=n=pjM�S=n=pj O [R"S5 [R"S5 URS5 [R"S	5 UHnU"S5 M
 [R"S5 g![a@n	USSup�XJRUSU	45 Sn	A	GM/![a	 Sn	A	GMAf=fSn	A	ff=f!S=n=pjf=f![a [R"S
5 N�f=f)Nz'task handler found thread._state != RUN�Fzdoing set_length()rrztask 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�r3�iterr[r�rrrarb�_set�KeyErrorrZr`)
r5rZrfr�r4r6�taskseq�
set_lengthrlrrrm�idxr�s
             rr��Pool._handle_taskss����)�)�+��#'�	�
�
�t�#<��G��D�
,�#�D��}�}��+��
�
�#L�M��!��D�	�$�"��
�
�#7�8�)-�d�1�g�2��"�3��7�+��(,�+��+�w���'+�+��+�w��1$=�4
�J�J�2�3�
	J��J�J�H�I��L�L���
�J�J�A�B����D�	��
	
�
�
�)�*��=%�!�#'���8���!�!�J�O�O�C�%���<�<��'�!� �!��	!��(,�+��+�w����	J��J�J�H�I�	J�sl�1F�&D6�.:F�AF
�6
F�E;�E%�F�%
E8	�/E;�0F�7E8	�8E;�;F�F�F
�
 F0�/F0c�n�[R"5nU"5nUR[:wa2UR[:XdS5e[R
"S5 O:Uc[R
"S5 O UupVnX%RXg5 S=n=pWM�U(arUR[:wa^U"5nUc[R
"S5 M>UupVnX%RXg5 S=n=pWU(aUR[:waM^[US5(aR[R
"S5 [S5H+nURR5(d OU"5 M- [R
"S	[U5UR5 g![[4a [R
"S5 gf=f![a GNHf=f![[4a [R
"S5 gf=f![a GN'f=f![[4a N�f=f)
Nz.result handler got EOFError/OSError -- exitingzThread not in TERMINATEz,result handler found thread._state=TERMINATEzresult handler got sentinelz&result handler ignoring extra sentinelr^z"ensuring that outqueue is not full�
z7result handler exiting: len(cache)=%s, thread._state=%s)r�r3r`r_rrar�rr
r<r=r\r�r^�pollr�)rfr[r4r6rlrmrn�objs        rr��Pool._handle_results=s����)�)�+���
��u��
�}�}��#��}�}�	�1�L�3L�L�1��
�
�I�J���|��
�
�8�9���K�C�C�
��
����'� $�#�D�#�3�+�.��
�
��2�
��u��
�|��
�
�C�D���K�C�C�
��
����'� $�#�D�#�3���
�
��2�"�8�Y�'�'��J�J�;�<�
��r��A�#�+�+�0�0�2�2���E�#�	
�
�
�L��%�j�&�-�-�	)��e�X�&�
��
�
�K�L��
�� �
��
���X�&�
��
�
�K�L��
���
��
���X�&�
��
�s_�F'�G�;G$�#H�.H!�/H!�'&G�G�
G!� G!�$&H
�H
�
H�H�!H4�3H4c#�~# �[U5n[[R"X55nU(dgX4v� M.7fr)r;�tupler�islice)ro�it�sizers    rr�Pool._get_tasksys8���
�"�X����i�&�&�r�0�1�A����)�O�	�s�;=c��[S5e)Nz:pool objects cannot be passed between processes or pickled)�NotImplementedErrorr%s rr;�Pool.__reduce__�s��!�J��	rc���[R"S5 UR[:Xa<[Ul[UR
lURRS5 gg)Nzclosing pool)rrar�rrr�r�rZr%s rr]�
Pool.close�sH���
�
�>�"��;�;�#���D�K�*/�D� � �'��!�!�%�%�d�+�rc�f�[R"S5 [UlUR	5 g)Nzterminating pool)rrar
r�r�r%s rr��Pool.terminate�s ���
�
�%�&�������rc��[R"S5 UR[:Xa[	S5eUR[
[4;a[	S5eURR5 URR5 URR5 URHnUR5 M g)Nzjoining poolzPool is still runningzIn unknown state)rrar�rr�rr
r�r6r�r�r�)r!r�s  rr6�	Pool.join�s����
�
�>�"��;�;�#���4�5�5�
�[�[��	� 2�
2��/�0�0����!�!�#������!����!�!�#����A�
�F�F�H�rc��[R"S5 URR5 UR	5(a�UR
R
5(ahUR
R5 [R"S5 UR	5(a"UR
R
5(aMfgggg)Nz7removing tasks from inqueue until task handler finishedr)
rra�_rlock�acquire�is_aliver^rDr��time�sleep)re�task_handlerrKs   r�_help_stuff_finish�Pool._help_stuff_finish�s���	
�
�
�L�M������ ��#�#�%�%�'�/�/�*>�*>�*@�*@��O�O� � �"��J�J�q�M��#�#�%�%�'�/�/�*>�*>�*@�*@�%�*@�%rc
���[R"S5 [UlUR	S5 [Ul[R"S5 URX'[
U55 UR5(d[
U	5S:wa[S5e[UlUR	S5 UR	S5 [R"S5 [R"5ULaUR5 U(aR[USS5(a>[R"S5 UH"n
U
RbMU
R5 M$ [R"S5 [R"5ULaUR5 [R"S	5 [R"5ULaUR5 U(a[USS5(aj[R"S
5 UHMn
U
R5(dM[R"SU
R-5 U
R5 MO ggg)Nzfinalizing poolz&helping task handler/workers to finishrz/Cannot have cache with result_handler not alivezjoining worker handlerr�zterminating workerszjoining task handlerzjoining result handlerzjoining pool workersr�)rrar
r�rZr]r�rYrXr�r3r6r\r�r��pid)r�r5rerfr�r/�worker_handlerr\�result_handlerr4r�s           rr��Pool._terminate_pool�s���	
�
�
�$�%�
!*������D�!�'����
�
�;�<����w�c�$�i�@��'�'�)�)��E�
�a�� �A�C�
C�!*������D�!����T��	
�
�
�+�,��#�#�%�^�;����!��G�D��G�[�1�1��J�J�,�-����:�:�%��K�K�M��	
�
�
�)�*��#�#�%�\�9������
�
�+�,��#�#�%�^�;����!��G�D��G�[�1�1��J�J�-�.����:�:�<�<��J�J�6����>�?��F�F�H�	�2�4rc�&�UR5 U$r)r�r%s r�	__enter__�Pool.__enter__�s�������rc�$�UR5 gr)r�)r!�exc_type�exc_val�exc_tbs    r�__exit__�
Pool.__exit__�s�����r)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)NNr-NNr)NNN)r)/r(r)r*r+rQr��staticmethodr�r"�warnings�warnrr�rOr�r�r�r�r�r�r�r�r�rrr�rrrr�r!r�r0�classmethodr�r�r�rr;r]r�r6r]r�rerkr,r-rrrr�s�����O��*��*�CE�04�O�f%�M�M�s�0�1�A�
�8��8��
��
�B��'��'�$�	9��	9�6�1� "��8�I�M�FJ��9�	J�@�:@�8&(�b�4���BF���KO���:�"��"�
�-��-�(�++��++�Z�9)��9)�v�����
,��

������3��3�j�rc�d�\rSrSrSrSrSrS
SjrS
SjrSr	\
"\R5r
S	rg)ri�c���Xl[R"5Ul[	[
5UlURUlX lX0l	XRUR'gr)
r�r��Event�_event�next�job_counterrr��	_callback�_error_callback)r!r�r�r�s    rr"�ApplyResult.__init__�sG���
��o�o�'�����%��	��k�k���!��-��!%���D�I�I�rc�6�URR5$r)rt�is_setr%s r�ready�ApplyResult.ready�s���{�{�!�!�#�#rc�x�UR5(d[SRU55eUR$)Nz{0!r} not ready)r|r�rY�_successr%s r�
successful�ApplyResult.successful�s.���z�z�|�|��.�5�5�d�;�<�<��}�}�rNc�:�URRU5 gr)rtr	�r!r-s  rr	�ApplyResult.wait�s��������!rc��URU5 UR5(d[eUR(aUR$URer)r	r|rr�_valuer�s  rr[�ApplyResult.get�s:���	�	�'���z�z�|�|����=�=��;�;���+�+�rc��UuUlUlUR(a,UR(aURUR5 UR(a,UR(dURUR5 URR5 URUR	SUlgr)	rr�rwrxrt�setr�rr��r!rnrEs   rr<�ApplyResult._setss��%(�"��
�t�{��>�>�d�m�m��N�N�4�;�;�'�����
�
�� � ����-��������K�K��	�	�"���
r)r�rwrxrtrr�rr�r)r(r)r*r+r"r|r�r	r[r<rp�types�GenericAlias�__class_getitem__r,r-rrrr�s3��&�$��
"���$�E�$6�$6�7�rrc� �\rSrSrSrSrSrg)r(ic�
�[RXUUS9 SUlS/U-UlX lUS::a9SUlURR5 URUR	gX2-[X2-5-Ulg)Nr&Tr)rr"rr��
_chunksize�_number_leftrtr�r�r�bool)r!r�r��lengthr�r�s      rr"�MapResult.__init__sz�����T��,:�	�	<���
��f�v�o���#����>� !�D���K�K�O�O�����D�I�I�&� &� 1�D��9K�4L� L�D�rc���U=RS-slUup4U(a�UR(a�X@RXR-US-UR-&URS:XaeUR(aUR	UR5 UR
UR	URR5 SUl	ggU(dUR(a
SUlX@lURS:XaeUR(aURUR5 UR
UR	URR5 SUl	gg)NrrF)r�rr�r�rwr�rrtr�r�rx)r!rn�success_result�successrqs     rr<�MapResult._set)s������Q���(����t�}�}�CI�K�K��/�/�)�1�Q�3����*?�@�� � �A�%��>�>��N�N�4�;�;�/��K�K��	�	�*������!�!��
�&��t�}�}� %��
�$��� � �A�%��'�'��(�(����5��K�K��	�	�*������!�!��
�
&r)r�r�r�rr�N)r(r)r*r+r"r<r,r-rrr(r(s
��M�"rr(c�:�\rSrSrSrSrS	Sjr\rSrSr	Sr
g)
riEc�D�Xl[R"[R"55Ul[[5UlURUl[R"5UlSUlSUl
0UlXRUR'g)Nr)r�r��	Condition�Lock�_condrurvrr��collections�deque�_items�_index�_length�	_unsorted)r!r�s  rr"�IMapIterator.__init__Gsl���
��(�(����)9�:��
���%��	��k�k���!�'�'�)������������!%���D�I�I�rc��U$rr-r%s r�__iter__�IMapIterator.__iter__Rs���rNc��UR URR5nSSS5 Wup4U(aU$Ue![a� URUR
:XaSUl[SeURRU5 URR5nN�![a0 URUR
:XaSUl[Se[Sef=ff=f!,(df   N�=fr)
r�r��popleft�
IndexErrorr�r�r��
StopIterationr	r)r!r-r�r�rEs     rru�IMapIterator.nextUs���
�Z�Z�

1��{�{�*�*�,��� �����L����!�
1��;�;�$�,�,�.�!%�D�J�'�T�1��
�
����(�1��;�;�.�.�0�D��!�1��{�{�d�l�l�2�%)��
�+��5�&�D�0�	1��
1���Z�s5�C+�A�A
C(�B*�(C+�*:C$�$C(�(C+�+
C9c��UR URU:Xa�URRU5 U=RS-
slURUR;aqURRUR5nURRU5 U=RS-
slURUR;aMqURR
5 OX RU'URUR:XaURUR	SUl
SSS5 g!,(df   g=f�Nr)r�r�r�r�r��pop�notifyr�r�rr�r�s   rr<�IMapIterator._setms���
�Z�Z��{�{�a�����"�"�3�'����q� ���k�k�T�^�^�3��.�.�,�,�T�[�[�9�C��K�K�&�&�s�+��K�K�1�$�K��k�k�T�^�^�3��
�
�!�!�#�$'���q�!��{�{�d�l�l�*��K�K��	�	�*�!��
��Z�Z�s�C
E�A!E�
Ec��UR XlURUR:Xa8URR5 URUR
	SUlSSS5 g!,(df   g=fr)r�r�r�r�r�rr�)r!r�s  rr�IMapIterator._set_length~sO��
�Z�Z�!�L��{�{�d�l�l�*��
�
�!�!�#��K�K��	�	�*�!��
��Z�Z�s�AA/�/
A=)r�r�r�r�rr�r�r�r)r(r)r*r+r"r�ru�__next__r<rr,r-rrrrEs"��	&���,�H�"�""rrc��\rSrSrSrSrg)ri�c�T�UR URRU5 U=RS-
slURR	5 URUR
:XaURUR	SUlSSS5 g!,(df   g=fr�)	r�r�r�r�r�r�r�rr�r�s   rr<�IMapUnorderedIterator._set�sj��
�Z�Z��K�K���s�#��K�K�1��K��J�J�����{�{�d�l�l�*��K�K��	�	�*�!��
�
�Z�Z�s�BB�
B')r�N)r(r)r*r+r<r,r-rrrr�s��"rrc�d�\rSrSrSr\S5rSSjrSrSr	\S5r
\S	5rS
rSr
g)
ri�Fc��SSKJn U"U0UD6$)Nrr�)�dummyr�)r�rrpr�s    rr��ThreadPool.Process�s��"���%��%�%rNc�0�[RXX#5 gr)rr")r!r�rgrhs    rr"�ThreadPool.__init__�s���
�
�d�{�=rc���[R"5Ul[R"5UlURRUlURRUlgr)r�r�r�r�rZr�r[r�r%s rr��ThreadPool._setup_queues�sD���)�)�+��
��*�*�,����-�-�+�+����.�.�,�,��rc�0�URR/$r)r�r^r%s rr��ThreadPool._get_sentinels�s���%�%�-�-�.�.rc��/$rr-)r�s rr�� ThreadPool._get_worker_sentinels�s���	rc��URSS9 M![Ra Of=f[U5HnUR	S5 M g)NF)�block)r[r��Emptyr�rZ)rer\rKrns    rr]�ThreadPool._help_stuff_finish�sM��	�����%��(����{�{�	��	���t��A��K�K���s��+�+c�0�[R"U5 gr)rZr[)r!r�r/r-s    rr0�ThreadPool._wait_for_updates�s���
�
�7�r)r�r�r�r�)NNr-)r(r)r*r+r�rmr�r"r�r�r�r]r0r,r-rrrr�sU���O��&��&�>�-�/���������r)Nr-NF))�__all__r�rr�r�r�rZr3r�rnr2rrr�
connectionr	r
rrr
�countrvrrrbrr/r:rArtrc�dictrx�objectrr�AsyncResultr(rrrr-rr�<module>r�s���<�
 ����	��������'���������	��o�o����5��i��0�0��<��<�"GK��+<�Z
�$��$�.v�6�v�x)8�&�)8�V��%"��%"�V?"�6�?"�J	"�L�	"�$��$r

?>