OwlCyberSecurity - MANAGER
Edit File: pool.cpython-312.opt-1.pyc
� ������h����������������������������d�dgZ�ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl mZ�ddl mZm Z �ddlmZ�dZd Zd ZdZ�ej(��������������������������Zd��Zd ��Z�G�d��de�������Z�G�d��d�������Zd��Z�G�d��de�������Z � �d#d�Zd��Z�G�d��de�������Z �G�d��d�e!�������Z"�G�d��de!�������Z#e#Z$�G�d��de#�������Z%�G�d��de!�������Z&�G�d ��d!e&�������Z'�G�d"��de"�������Z(y)$�Pool� ThreadPool�����N����)�util)�get_context�TimeoutError)�wait�INIT�RUN�CLOSE� TERMINATEc������������������$�����t��������t��������|����������S��N)�list�map��argss��� �;/opt/alt/python312/lib64/python3.12/multiprocessing/pool.py�mapstarr���/���s��������T� �������c������������������L�����t��������t��������j������������������|�d���|�d�����������������S�)Nr���r���)r���� itertools�starmapr���s��� r����starmapstarr���2���s"������� �!�!�$�q�'�4��7�3�4�4r���c�������������������������e�Zd�Zd��Zd��Zy)�RemoteTracebackc�����������������������||�_���������y�r�����tb)�selfr���s��� r����__init__zRemoteTraceback.__init__:���s ��������r���c�����������������������|�j�������������������S�r���r����r ���s��� r����__str__zRemoteTraceback.__str__<���s�������w�w�r���N)�__name__� __module__�__qualname__r!���r$�����r���r���r���r���9���s�������r���r���c�������������������������e�Zd�Zd��Zd��Zy)�ExceptionWithTracebackc�����������������������t��������j������������������t��������|�������||�������}dj������������������|�������}||�_��������d|z��|�_��������y�)N��z """ %s""")� traceback�format_exception�type�join�excr���)r ���r1���r���s��� r���r!���zExceptionWithTraceback.__init__@���s:������ � '� '��S� �3�� ;�� �W�W�R�[����� �2�%��r���c������������������>�����t���������|�j������������������|�j������������������ffS�r���)�rebuild_excr1���r���r#���s��� r���� __reduce__z!ExceptionWithTraceback.__reduce__E���s�������T�X�X�t�w�w�/�/�/r���N)r%���r&���r'���r!���r4���r(���r���r���r*���r*���?���s������&� 0r���r*���c������������������&�����t��������|�������|�_��������|�S�r���)r���� __cause__)r1���r���s��� r���r3���r3���H���s������#�B�'�C�M��Jr���c��������������������.�������e�Zd�ZdZ��fd�Zd��Zd��Z��xZS�)�MaybeEncodingErrorzVWraps possible unpickleable errors, so they can be safely sent through the socket.c������������������������t��������|�������|�_��������t��������|�������|�_��������t��������t��������|����|�j������������������|�j��������������������������y�r���)�reprr1����value�superr8���r!���)r ���r1���r;���� __class__s��� �r���r!���zMaybeEncodingError.__init__T���s3���������9����%�[�� � � �$�0����4�:�:�Fr���c������������������<�����d|�j��������������������d|�j�������������������d�S�)NzError sending result: 'z'. Reason: '�')r;���r1���r#���s��� r���r$���zMaybeEncodingError.__str__Y���s������=A�Z�Z�=A�X�X�G�� Gr���c������������������<�����d|�j�������������������j�������������������d|��d�S�)N�<z: �>)r=���r%���r#���s��� r����__repr__zMaybeEncodingError.__repr__]���s������!�^�^�4�4�d�;�;r���)r%���r&���r'����__doc__r!���r$���rC���� __classcell__�r=���s���@r���r8���r8���P���s�������'�G� G�<r���r8���c������������������|����|�/t��������|t���������������r|dk\��st��������dj������������������|���������������|j������������������}|�j ������������������}t ��������|�d�������r4|�j������������������j���������������������������|j������������������j���������������������������|��||���d}|�|r`||k��r[ ��|��������} | �t��������j������������������d��������n;| \��} }}} } �d�|| i�|��f} ��|| ||f��������d�x} x} x}x}x} }|dz ��}|��S|r||k��r�[t��������j������������������d |z����������y�#�t��������t��������f$�r�t��������j������������������d��������Y��?w�xY�w#�t��������$�r.}|r|t��������urt!��������||j"�������������������������}d|f}Y�d�}~��d�}~ww�xY�w#�t��������$�r>}t%��������||d����������}t��������j������������������d |z�����������|| |d|ff��������Y�d�}~��d�}~ww�xY�w)Nr���zMaxtasks {!r} is not valid�_writerr���z)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�hasattrrH����close�_reader�EOFError�OSErrorr����debug� Exception�_helper_reraises_exceptionr*���� __traceback__r8���)�inqueue�outqueue�initializer�initargs�maxtasks�wrap_exceptionrM���rN���� completed�task�job�i�funcr����kwds�result�e�wrappeds��� r����workerrg���a���s��������z�(�C�'@�+3�q�=��9�@�@��J�K�K� �,�,�C� �+�+�C��w� �"������������ ����X���I� � �x�I��,@� ��5�D� ��<��J�J�7�8��#'� ��Q��d�D� ��D�$�/�$�/�0�F� ,���a�� �!��48�7��7�s�7�V�7�d�7�T�D��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���� ���a�%��)�*�+�+�� ,�sB����D�� D:��E4��$D7�6D7�: E1�$E,�,E1�4 F;�=4F6�6F;c�����������������������|��)z@Pickle-able helper function for use by _guarded_task_generation.r(���)�exs��� r���rV���rV�������s������ �Hr���c��������������������2�������e�Zd�ZdZdd���fd� Z��fd�Z��xZS�)� _PoolCachez� 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������||�_���������t���������|����|i�|���y�r���)rm���r<���r!���)r ���rm���r���rc���r=���s��� �r���r!���z_PoolCache.__init__����s������� �� � ���$�'�$�'r���c������������������`������t����������|����|��������|�s|�j������������������j������������������d���������y�y�r���)r<����__delitem__rm���rM���)r ����itemr=���s��� �r���rp���z_PoolCache.__delitem__����s,������� ���D�!����M�M���d�#��r���)r%���r&���r'���rD���r!���rp���rE���rF���s���@r���rk���rk�������s���������+/��(� $�� $r���rk���c������������������������e�Zd�ZdZdZed����������Z � �d(d�Zej������������������e fd�Zd��Zd ��Z ed ����������Zed����������Zd��Zed ����������Zed����������Zd��Zd��Zdi�fd�Zd)d�Zd)d�Z � �d*d�Zd��Zd+d�Zd+d�Zdi�ddfd�Z � �d*d�Z � �d*d�Zed)d���������Ze d����������Z!ed����������Z"ed����������Z#ed����������Z$d ��Z%d!��Z&d"��Z'd#��Z(ed$����������Z)e d%����������Z*d&��Z+d'��Z,y),r���zS Class which supports an async version of applying functions to arguments. Tc������������������&������|�j�������������������|i�|��S�r�����Process)�ctxr���rc���s��� r���ru���zPool.Process����s�������s�{�{�D�)�D�)�)r���Nr(���c����������������������g�|�_���������t��������|�_��������|xs �t����������������|�_��������|�j���������������������������t ��������j��������������������������|�_��������|�j������������������j��������������������������|�_ ��������t��������|�j��������������������������|�_��������||�_��������||�_ ��������||�_��������|�t��������j ��������������������������xs�d}|dk��rt#��������d��������|� t%��������|t&���������������r|dk��rt#��������d��������|�t)��������|�������st+��������d��������||�_�������� �|�j/���������������������������|�j9��������������������������}t;��������j<������������������t>��������j@������������������|�j������������������|�j������������������|�j������������������|�jB������������������|�j,������������������|�j�������������������|�jD������������������|�jF������������������|�j������������������|�j������������������|�j������������������|�jH������������������||�j������������������f��������|�_%��������d|�jJ������������������_&��������tN��������|�jJ������������������_��������|�jJ������������������jQ���������������������������t;��������j<������������������t>��������jR������������������|�j������������������|�jT������������������|�jF������������������|�j�������������������|�j������������������f��������|�_+��������d|�jV������������������_&��������tN��������|�jV������������������_��������|�jV������������������jQ���������������������������t;��������j<������������������t>��������jX������������������|�jF������������������|�jZ������������������|�j������������������f��������|�_.��������d|�j\������������������_&��������tN��������|�j\������������������_��������|�j\������������������jQ���������������������������t_��������j`������������������|�|�jb������������������|�j������������������|�jD������������������|�jF������������������|�j�������������������|�j������������������|�jJ������������������|�jV������������������|�j\������������������|�j������������������f d � �������|�_2��������tN��������|�_��������y�#�t0��������$�rQ�|�j�������������������D�]��}|j2��������������������|j5����������������������������!�|�j�������������������D�]��}|j7�������������������������������w�xY�w)Nrl���r���z&Number of processes must be at least 1r���z/maxtasksperchild must be a positive int or Nonezinitializer must be a callable��targetr���T����)r����exitpriority)3�_poolr ����_stater����_ctx� _setup_queues�queue�SimpleQueue� _taskqueue�_change_notifierrk����_cache�_maxtasksperchild�_initializer� _initargs�os� cpu_count� ValueErrorrI���rJ����callable� TypeError� _processes�_repopulate_poolrU����exitcode� terminater0����_get_sentinels� threading�Threadr����_handle_workersru����_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 ���� processesrZ���r[����maxtasksperchild�context�p� sentinelss��� r���r!���z Pool.__init__����sL�������� �����,�{�}�� ������+�+�-����!%� � � 5� 5� 7��� �$�*?�*?�@���!1���'���!���������+�!�I��q�=��E�F�F��'��.��4�8H�A�8M� �!R�S�S��"�8�K�+@��<�=�=�#��� ��!�!�#���'�'�)� �(�/�/��'�'��+�+�t���� � �4�<�<��/�/�4�:�:�t�}�}�d�n�n��#�#�T�^�^�T�5K�5K��&�&� �4�3H�3H�J� ����'+����#�&)����#����"�"�$��'�-�-��%�%��/�/�4�?�?�D�N�N��*�*�d�k�k�+���� �%)����!�$'����!���� � �"�(�/�/��'�'��.�.�$�/�/�4�;�;�?� ����'+����#�&)����#����"�"�$��-�-��$�&�&��/�/�4�=�=�$�.�.�$�*�*��'�'��)=�)=�t�?Q�?Q��&�&����5�����������]��� ��Z�Z���:�:�%��K�K�M�� ���Z�Z������� �� �s���� O'��'$Q�5Qc�����������������������|�j�������������������|k(��r<�|d|���t��������|����������t��������|�dd���������|�j������������������j ������������������d���������y�y�y�)Nz&unclosed running multiprocessing pool )�sourcer����)r}����ResourceWarning�getattrr����rM���)r ����_warnr���s��� r����__del__zPool.__del__ ��sT�������;�;�#���:�4�(�C�!�$� 0��t�/��6�B��%�%�)�)�$�/��C��r���c����������� ������������|�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��� r���rC���z Pool.__repr__��sQ�������n�n���C�N�N�#�1�S�%5�%5�$6��7���� ��&� ����_�-�Q�0�� 1r���c������������������j�����|�j�������������������j������������������g}|�j������������������j������������������g}g�|�|�S�r���)r����rQ���r����)r ����task_queue_sentinels�self_notifier_sentinelss��� r���r����zPool._get_sentinels��s<������ $��� 6� 6�7��#'�#8�#8�#@�#@�"A��@�%�@�(?�@�@r���c������������������X�����|�D��cg�c]��}t��������|d�������r|j���������������������c}S�c�c}w�)N�sentinel)rO���r����)�workersrg���s��� r����_get_worker_sentinelszPool._get_worker_sentinels��s:��������8���%+�"�6�:�6������8�� 8���8s����'c������������������������d}t��������t��������t��������|����������������������D�]A��}|�|���}|j��������������������t ��������j ������������������d|z����������|j ���������������������������d}|�|=��C�|S�)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����r���rT���r0���)�pool�cleanedra���rg���s��� r����_join_exited_workerszPool._join_exited_workers!��sb������ ����%��D� �*�+�A��!�W�F����*�� � �2�Q�6�7���� �����G��,���r���c�����������������������|�j������������������|�j������������������|�j������������������|�j������������������|�j������������������|�j ������������������|�j������������������|�j������������������|�j������������������|�j������������������|�j������������������� ������S�r���)�_repopulate_pool_staticr~���ru���r����r|���r����r����r����r����r����r����r#���s��� r���r����zPool._repopulate_pool1��s_�������+�+�D�I�I�t�|�|�,0�O�O�,0�J�J�� � �,0�N�N�D�<M�<M�,0�N�N�,0�,B�,B�,0�,@�,@� B�� Br���c ������������������"����t��������|t��������|�������z ���������D�]u��} �||�t��������|||||| f��������}|j������������������j ������������������dd�������|_��������d|_��������|j ���������������������������|j������������������|��������t��������j������������������d���������w�y)z�Bring the number of pool processes up to the specified number, for use after reaping workers which have exited. rx���ru���� PoolWorkerTzadded workerN) r����r����rg����name�replacer����r�����appendr���rT���)rv���ru���r����r����rX���rY���rZ���r[���r����r]���ra����ws��� r���r����zPool._repopulate_pool_static:��s��������y�3�t�9�,�-�A���F�%�x�)�&�(8�,�.�/�A� ��V�V�^�^�I�|�<�A�F��A�H� �G�G�I��K�K��N��J�J�~�&��.r���c ������������������l�����t���������j������������������|�������rt���������j������������������|�||||||||| � �������yy)zEClean up any exited workers and start replacements for them. N)r���r����r����) rv���ru���r����r����rX���rY���rZ���r[���r����r]���s ��� r����_maintain_poolzPool._maintain_poolM��s=��������$�$�T�*��(�(��g�y�$�)0�(�K�)1�3C�)7� 9��+r���c����������������������|�j�������������������j��������������������������|�_��������|�j�������������������j��������������������������|�_��������|�j������������������j������������������j ������������������|�_��������|�j������������������j������������������j������������������|�_ ��������y�r���) r~���r����r����r����rH����sendr����rQ����recvr����r#���s��� r���r���zPool._setup_queuesY��sX������� � �-�-�/�� ����.�.�0����-�-�/�/�4�4����.�.�0�0�5�5��r���c������������������@�����|�j�������������������t��������k7��rt��������d��������y�)NzPool not running)r}���r���r����r#���s��� r����_check_runningzPool._check_running_��s�������;�;�#���/�0�0��r���c������������������D�����|�j������������������|||�������j��������������������������S�)zT Equivalent of `func(*args, **kwds)`. Pool must be running. )�apply_asyncrN���)r ���rb���r���rc���s��� r����applyz Pool.applyc��s"������ �����d�D�1�5�5�7�7r���c������������������N�����|�j������������������||t��������|�������j��������������������������S�)zx Apply `func` to each element in `iterable`, collecting the results in a list that is returned. )� _map_asyncr���rN����r ���rb����iterable� chunksizes��� r���r���zPool.mapj��s"������ ����t�X�w� �B�F�F�H�Hr���c������������������N�����|�j������������������||t��������|�������j��������������������������S�)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����r���rN���r����s��� r���r���zPool.starmapq��s"����������t�X�{�I�F�J�J�L�Lr���c������������������6�����|�j������������������||t��������|||�������S�)z= Asynchronous version of `starmap()` method. )r����r����r ���rb���r����r�����callback�error_callbacks��� r���� starmap_asynczPool.starmap_asyncy��s"������ ����t�X�{�I�'��9�� 9r���c��������������#�������K���� �d}t��������|�������D�]��\��}}||||fi�f�����y#�t��������$�r}|dz���t��������|fi�f���Y�d}~yd}~ww�xY�w�w)z�Provides a generator of tasks for imap and imap_unordered with appropriate handling for iterables which throw exceptions during iteration.���r���N)� enumeraterU���rV���)r ���� result_jobrb���r����ra����xre���s��� r����_guarded_task_generationzPool._guarded_task_generation���s`��������� J��A�!�(�+���1�!�1�d�Q�D�"�5�5��,���� J��q��s�$>���b�I�I�� J�s)����A�$��A� A�A�A�A�Ac�����������������������|�j���������������������������|dk(��rOt��������|��������}|�j������������������j������������������|�j ������������������|j ������������������||�������|j������������������f��������|S�|dk��rt��������dj������������������|���������������t��������j������������������|||�������}t��������|��������}|�j������������������j������������������|�j ������������������|j ������������������t��������|�������|j������������������f��������d��|D���������S�)zP Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. r���zChunksize must be 1+, not {0:n}c��������������3����.���K����|�] ��}|D�]��}|�������y��wr���r(�����.0�chunkrq���s��� r���� <genexpr>zPool.imap.<locals>.<genexpr>�������������?�f�U���D��D�f������)r�����IMapIteratorr����rM���r�����_job�_set_lengthr����rL���r���� _get_tasksr����r ���rb���r����r����rd����task_batchess��� r����imapz Pool.imap���s�������� ������>�!�$�'�F��O�O����1�1�&�+�+�t�X�N��&�&�� � ��M��1�}� �5�<�<�!�#�$��$�� �?�?�4��9�E�L�!�$�'�F��O�O����1�1�&�+�+�29�2>�@���&�&� � ��@�f�?�?r���c�����������������������|�j���������������������������|dk(��rOt��������|��������}|�j������������������j������������������|�j ������������������|j ������������������||�������|j������������������f��������|S�|dk��rt��������dj������������������|���������������t��������j������������������|||�������}t��������|��������}|�j������������������j������������������|�j ������������������|j ������������������t��������|�������|j������������������f��������d��|D���������S�)zL Like `imap()` method but ordering of results is arbitrary. r���zChunksize must be 1+, not {0!r}c��������������3����.���K����|�] ��}|D�]��}|�������y��wr���r(���r����s��� r���r����z&Pool.imap_unordered.<locals>.<genexpr>���r����r����)r�����IMapUnorderedIteratorr����rM���r����r����r����r����rL���r���r����r���r����s��� r����imap_unorderedzPool.imap_unordered���s�������� ������>�*�4�0�F��O�O����1�1�&�+�+�t�X�N��&�&�� � ��M��1�}� �5�<�<�Y�G�I��I��?�?�4��9�E�L�*�4�0�F��O�O����1�1�&�+�+�29�2>�@���&�&� � ��@�f�?�?r���c�����������������������|�j���������������������������t��������|�||�������}|�j������������������j������������������|j������������������d|||fgdf��������|S�)z; Asynchronous version of `apply()` method. r���N)r�����ApplyResultr����rM���r����)r ���rb���r���rc���r����r����rd���s��� r���r����zPool.apply_async���sL������ � �����T�8�^�<�������v�{�{�A�t�T�4�@�A�4�H�I�� r���c������������������6�����|�j������������������||t��������|||�������S�)z9 Asynchronous version of `map()` method. )r����r���r����s��� r���� map_asynczPool.map_async���s"������ ����t�X�w� �8���� r���c����������������������|�j���������������������������t��������|d�������st��������|�������}|�5t��������t ��������|�������t ��������|�j �������������������������dz���������\��}}|r|dz ��}t ��������|�������dk(��rd}t��������j������������������|||�������}t��������|�|t ��������|�������||��������} |�j������������������j������������������|�j������������������| j������������������||�������df��������| S�)zY Helper function to implement map, starmap and their async counterparts. �__len__N����r���r����r����) r����rO���r����divmodr����r|���r���r����� MapResultr����rM���r����r����) r ���rb���r�����mapperr����r����r�����extrar����rd���s ��� r���r����zPool._map_async���s������� � �����x��+��H�~�H���%�c�(�m�S����_�q�5H�I��I�u���Q�� ��x�=�A���I����t�X�y�A���4��C��M�8�*8�:��������-�-�f�k�k�.4�.:�<��� � ��� r���c�����������������������t��������|�|���������|j��������������������������s"|j���������������������������|j��������������������������s�!y�y�)N)�timeout)r ����emptyrN���)r�����change_notifierr��s��� r����_wait_for_updateszPool._wait_for_updates���s2�������Y��(�!�'�'�)����!��"�'�'�)r���c����������������������t��������j��������������������������}|j������������������t��������k(��s|r~|j������������������t��������k7��rk|�j������������������||||||| | ||� �������g�|�j ������������������|��������| �}|�j������������������||��������|j������������������t��������k(��r�U|r|j������������������t��������k7��r�k|j������������������d���������t��������j������������������d��������y�)Nzworker handler exiting)r�����current_threadr}���r���r ���r����r����r��rM���r���rT���)r�����cache� taskqueuerv���ru���r����r����rX���rY���rZ���r[���r����r]���r����r���thread�current_sentinelss��� r���r����zPool._handle_workers���s������� ��)�)�+����m�m�s�"�u����)�1K����s�G�Y��g�'��h�/�� A��!O�#�";�";�D�"A� N�I� N���!�!�"3�_�E���m�m�s�"�u����)�1K�� � � �d��� � �+�,r���c������������������0����t��������j��������������������������}t��������|�j������������������d��������D�]}��\��}}d�} �|D�]5��}|j������������������t ��������k7��rt ��������j������������������d���������n> ��||���������7�|r)t ��������j������������������d��������|r|d���nd}�||dz����������� �d�x}x}} �v �d�x}x}} �n�t ��������j������������������d�������� �t ��������j������������������d��������|j������������������d���������t ��������j������������������d ��������|D�] ��}�|d����������� �t ��������j������������������d��������y�#�t��������$�r;} |d�d�\��} } �|| ���j������������������|d| f��������n#�t��������$�r�Y�nw�xY�wY�d�} ~ ��+d�} ~ ww�xY�w#�d�x}x}} w�xY�w#�t��������$�r�t ��������j������������������d ��������Y���w�xY�w)Nz'task handler found thread._state != RUN����Fzdoing set_length()r���r����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 ���iterrN���r}���r���r���rT���rU����_set�KeyErrorrM���rS���) r��rM���rY���r����r ��r���taskseq� set_lengthr_���re���r`����idxr����s ��� r���r����zPool._handle_tasks��s�������)�)�+��#'� � � �t�#<��G�Z��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���S�!�!�#�J�O�O�C�%���<��'��!� �!��� !���(,�+��+�w������ J��J�J�H�I� J�sl����/E)�$D"�,-E)�A E4��" E&�+E!�4E�E!� E �E!�E �E!�E)�!E&�&E)�)E1�4F�Fc�����������������������t��������j��������������������������} � ��|��������}|j������������������t��������k7��rt ��������j ������������������d��������n;|�t ��������j ������������������d��������n#|\��}}} �||���j������������������||��������d�x}x}}�l|rk|j������������������t��������k7��rX ��|��������}|�t ��������j ������������������d���������5|\��}}} �||���j������������������||��������d�x}x}}|r|j������������������t��������k7��r�Xt��������|�d�������rIt ��������j ������������������d�������� �t��������d�������D�]%��}|�j������������������j��������������������������s�n �|����������'�t ��������j ������������������dt��������|�������|j��������������������������y�#�t��������t��������f$�r�t ��������j ������������������d��������Y�y�w�xY�w#�t��������$�r�Y���*w�xY�w#�t��������t��������f$�r�t ��������j ������������������d��������Y�y�w�xY�w#�t��������$�r�Y���w�xY�w#�t��������t��������f$�r�Y���w�xY�w) Nz.result handler got EOFError/OSError -- exitingz,result handler found thread._state=TERMINATEzresult handler got sentinelz&result handler ignoring extra sentinelrQ���z"ensuring that outqueue is not full� ���z7result handler exiting: len(cache)=%s, thread._state=%s)r����r ��rS���rR���r���rT���r}���r���r��r��r ���rO���r����rQ����pollr����)rY���rN���r ��r��r_���r`���ra����objs��� r���r����zPool._handle_results=��s�������)�)�+��� ��u�� ��}�}��#�� � �I�J���|�� � �8�9���K�C��C� ��c� ����3�'�� $�#�D�#�3��+��.��� � ��2� ��u�� ��|�� � �C�D���K�C��C� ��c� ����3�'�� $�#�D�#�3����� � ��2�"��8�Y�'��J�J�;�<� ��r��A�#�+�+�0�0�2���E��#�� � � �L��%�j�&�-�-� )��e��X�&�� �� � �K�L�� �� ��� �� ����X�&�� �� � �K�L�� ����� �� ����X�&�� �� �sY����E/��&F��F)��>G��3G#��/$F�F� F&�%F&�)$G�G� G �G �#G5�4G5c��������������#����t���K����t��������|�������} �t��������t��������j������������������||��������������}|sy�|�|f����)�wr���)r���tupler����islice)rb����it�sizer����s��� r���r����zPool._get_tasksy��s=��������� �"�X����i�&�&�r�4�0�1�A�����)�O� ��s����68c�����������������������t��������d��������)Nz:pool objects cannot be passed between processes or pickled)�NotImplementedErrorr#���s��� r���r4���zPool.__reduce__���s������!�J��� r���c������������������������t��������j������������������d��������|�j������������������t��������k(��r<t��������|�_��������t��������|�j ������������������_��������|�j������������������j������������������d���������y�y�)Nzclosing pool)r���rT���r}���r���r���r����r����rM���r#���s��� r���rP���z Pool.close���sH������� � �>�"��;�;�#���D�K�*/�D� � �'��!�!�%�%�d�+��r���c������������������d�����t��������j������������������d��������t��������|�_��������|�j ���������������������������y�)Nzterminating pool)r���rT���r ���r}���r����r#���s��� r���r����zPool.terminate���s ������� � �%�&�������r���c����������������������t��������j������������������d��������|�j������������������t��������k(��rt ��������d��������|�j������������������t ��������t��������fvrt ��������d��������|�j������������������j���������������������������|�j������������������j���������������������������|�j������������������j���������������������������|�j������������������D�]��}|j�����������������������������y�)Nzjoining poolzPool is still runningzIn unknown state)r���rT���r}���r���r����r���r ���r����r0���r����r����r|���)r ���r����s��� r���r0���z Pool.join���s�������� � �>�"��;�;�#���4�5�5� �[�[�� � 2� 2��/�0�0����!�!�#������!����!�!�#����A� �F�F�H��r���c������������������p����t��������j������������������d��������|�j������������������j���������������������������|j ��������������������������rw|�j ������������������j ��������������������������r\|�j ������������������j���������������������������t��������j������������������d��������|j ��������������������������r|�j ������������������j ��������������������������r�Zy�y�y�y�)Nz7removing tasks from inqueue until task handler finishedr���) r���rT����_rlock�acquire�is_aliverQ���r��r�����time�sleep)rX����task_handlerr��s��� r����_help_stuff_finishzPool._help_stuff_finish���s}������� � � �L�M������ ��#�#�%�'�/�/�*>�*>�*@��O�O� � �"��J�J�q�M���#�#�%�'�/�/�*>�*>�*@�%�*@�%r���c ������������������d����t��������j������������������d��������t��������|_��������|j ������������������d���������t��������|_��������t��������j������������������d��������|�j������������������||t ��������|���������������|j��������������������������st ��������| �������dk7��rt��������d��������t��������|_��������|j ������������������d���������|j ������������������d���������t��������j������������������d��������t��������j��������������������������|ur|j���������������������������|rHt��������|d���d�������r9t��������j������������������d��������|D�]��} | j��������������������| j����������������������������!�t��������j������������������d��������t��������j��������������������������|ur|j���������������������������t��������j������������������d ��������t��������j��������������������������|ur|j���������������������������|rpt��������|d���d�������r`t��������j������������������d ��������|D�]E��} | j��������������������������s�t��������j������������������d| j������������������z����������| j����������������������������G�y�y�y�)Nzfinalizing poolz&helping task handler/workers to finishr���z/Cannot have cache with result_handler not alivezjoining worker handlerr����zterminating workerszjoining task handlerzjoining result handlerzjoining pool workersr����)r���rT���r ���r}���rM���r+��r����r'��rK���r����r ��r0���rO���r����r�����pid)r����r��rX���rY���r����r���worker_handlerr*���result_handlerr ��r����s��� r���r����zPool._terminate_pool���s������� � � �$�%� �!*������D�!�'���� � �;�<����w��c�$�i�@��'�'�)��E� �a�� �A�C�� C��!*������D�!����T��� � � �+�,��#�#�%�^�;����!���G�D��G�[�1��J�J�,�-����:�:�%��K�K�M���� � � �)�*��#�#�%�\�9������ � �+�,��#�#�%�^�;����!��G�D��G�[�1��J�J�-�.����:�:�<��J�J�6����>�?��F�F�H� ���2�4r���c������������������&�����|�j���������������������������|�S�r���)r����r#���s��� r���� __enter__zPool.__enter__���s�����������r���c������������������$�����|�j���������������������������y�r���)r����)r ����exc_type�exc_val�exc_tbs��� r����__exit__z Pool.__exit__���s���������r���)NNr(���NNr���)NNN)r���)-r%���r&���r'���rD���r�����staticmethodru���r!����warnings�warnr���r����rC���r����r����r����r����r����r����r���r����r����r���r���r����r����r����r����r����r����r����r���classmethodr����r����r����r����r4���rP���r����r0���r+��r����r1��r6��r(���r���r���r���r�������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�r���c��������������������X�����e�Zd�Zd��Zd��Zd��Zdd�Zdd�Zd��Z�e e j�������������������������Zy) r����c������������������������||�_���������t��������j��������������������������|�_��������t ��������t ���������������|�_��������|j������������������|�_��������||�_��������||�_ ��������|�|�j������������������|�j������������������<���y�r���) r|���r�����Event�_event�next�job_counterr����r����� _callback�_error_callback)r ���r����r����r����s��� r���r!���zApplyResult.__init__���sO�������� ��o�o�'�����%�� ��k�k���!���-���!%����D�I�I�r���c������������������6�����|�j�������������������j��������������������������S�r���)r>���is_setr#���s��� r����readyzApplyResult.ready���s�������{�{�!�!�#�#r���c������������������n�����|�j��������������������������st��������dj������������������|����������������|�j������������������S�)Nz{0!r} not ready)rE��r����rL����_successr#���s��� r���� successfulzApplyResult.successful���s,�������z�z�|��.�5�5�d�;�<�<��}�}�r���Nc������������������:�����|�j�������������������j������������������|��������y�r���)r>��r ����r ���r��s��� r���r ���zApplyResult.wait���s������������!r���c�����������������������|�j������������������|��������|�j��������������������������st���������|�j������������������r|�j������������������S�|�j�������������������r���)r ���rE��r���rG���_valuerJ��s��� r���rN���zApplyResult.get���s8������� � �'���z�z�|����=�=��;�;���+�+�r���c������������������^����|\��|�_���������|�_��������|�j������������������r'|�j�������������������r|�j������������������|�j��������������������������|�j������������������r'|�j�������������������s|�j������������������|�j��������������������������|�j������������������j���������������������������|�j������������������|�j������������������=�d�|�_��������y�r���) rG��rL��rA��rB��r>���setr����r����r|����r ���ra���r��s��� r���r��zApplyResult._set��ss������%(�"�� �t�{��>�>�d�m�m��N�N�4�;�;�'����� � �� � ����-��������K�K�� � �"��� r���r���) r%���r&���r'���r!���rE��rH��r ���rN���r��r:���types�GenericAlias�__class_getitem__r(���r���r���r����r�������s3������&�$�� "����$�E�$6�$6�7�r���r����c�������������������������e�Zd�Zd��Zd��Zy)r���c����������������������t���������j������������������|�|||���������d|�_��������d�g|z��|�_��������||�_��������|dk��r9d|�_��������|�j������������������j���������������������������|�j������������������|�j������������������=�y�||z��t��������||z���������z���|�_��������y�)Nr����Tr���)r����r!���rG��rL��� _chunksize�_number_leftr>��rN��r����r�����bool)r ���r����r�����lengthr����r����s��� r���r!���zMapResult.__init__��s����������T�4��,:�� �� <��� ��f�v�o���#�����>� !�D���K�K�O�O�����D�I�I�&� &� � 1�D��)�9K�4L� L�D�r���c����������������������|�xj�������������������dz��c_���������|\��}}|r�|�j������������������r�||�j������������������||�j������������������z��|dz���|�j������������������z���|�j�������������������dk(��r`|�j������������������r|�j ������������������|�j��������������������������|�j ������������������|�j������������������=�|�j������������������j���������������������������d�|�_ ��������y�y�|s|�j������������������rd|�_��������||�_��������|�j�������������������dk(��r`|�j������������������r|�j������������������|�j��������������������������|�j ������������������|�j������������������=�|�j������������������j���������������������������d�|�_ ��������y�y�)Nr���r���F)rV��rG��rL��rU��rA��r����r����r>��rN��r|���rB��)r ���ra����success_result�successrd���s��� r���r��zMapResult._set)��s��������Q���(�����t�}�}�CI�D�K�K��$�/�/�)�1�Q�3����*?�@�� � �A�%��>�>��N�N�4�;�;�/��K�K�� � �*������!�!�� ��&���t�}�}� %�� �$���� � �A�%��'�'��(�(����5��K�K�� � �*������!�!�� � �&r���N)r%���r&���r'���r!���r��r(���r���r���r���r�����s ������M�"r���r���c��������������������0�����e�Zd�Zd��Zd��Zdd�ZeZd��Zd��Zy)r����c������������������B����||�_���������t��������j������������������t��������j���������������������������������|�_��������t��������t���������������|�_��������|j������������������|�_��������t��������j��������������������������|�_��������d|�_��������d�|�_ ��������i�|�_��������|�|�j������������������|�j������������������<���y�)Nr���)r|���r����� Condition�Lock�_condr?��r@��r����r�����collections�deque�_items�_index�_length� _unsorted)r ���r����s��� r���r!���zIMapIterator.__init__G��sp�������� ��(�(����)9�:�� ���%�� ��k�k���!�'�'�)������������!%����D�I�I�r���c�����������������������|�S�r���r(���r#���s��� r����__iter__zIMapIterator.__iter__R��s�������r���Nc�����������������������|�j�������������������5�� �|�j������������������j��������������������������}d�d�d���������\��}}|r|S�|�#�t��������$�r��|�j������������������|�j ������������������k(��rd�|�_��������t��������d��|�j�������������������j������������������|�������� �|�j������������������j��������������������������}n;#�t��������$�r/�|�j������������������|�j ������������������k(��rd�|�_��������t��������d��t��������d��w�xY�wY���w�xY�w#�1�sw�Y�����xY�wr���) r`��rc���popleft� IndexErrorrd��re��r|���� StopIterationr ���r���)r ���r��rq���r[��r;���s��� r���r?��zIMapIterator.nextU��s������� �Z�Z� 1��{�{�*�*�,���� �������L����!��� 1��;�;�$�,�,�.�!%�D�J�'�T�1�� � ����(�1��;�;�.�.�0�D��!��1��{�{�d�l�l�2�%)�� �+��5�&�D�0� 1���� 1����Z�s?����C$�<�AC!�B#�"C!�#8C�C!�C$� C!�!C$�$C-c����������������������|�j�������������������5��|�j������������������|k(��r�|�j������������������j������������������|��������|�xj������������������dz ��c_��������|�j������������������|�j������������������v�rn|�j������������������j������������������|�j�������������������������}|�j������������������j������������������|��������|�xj������������������dz ��c_��������|�j������������������|�j������������������v�r�n|�j�������������������j ���������������������������n||�j������������������|<���|�j������������������|�j������������������k(��r|�j������������������|�j������������������=�d�|�_ ��������d�d�d���������y�#�1�sw�Y���y�xY�w�Nr���)r`��rd��rc��r����rf���pop�notifyre��r����r����r|���rO��s��� r���r��zIMapIterator._setm��s������� �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����CD=�A!D=�=Ec�����������������������|�j�������������������5��||�_��������|�j������������������|�j������������������k(��r8|�j�������������������j���������������������������|�j������������������|�j ������������������=�d�|�_��������d�d�d���������y�#�1�sw�Y���y�xY�wr���)r`��re��rd��rp��r����r����r|���)r ���rX��s��� r���r����zIMapIterator._set_length~��sQ������ �Z�Z�!�D�L��{�{�d�l�l�*�� � �!�!�#��K�K�� � �*�!�� ���Z�Z�s����AA/�/A8r���) r%���r&���r'���r!���rh��r?���__next__r��r����r(���r���r���r����r����E��s"������ &���,��H�"�""r���r����c�������������������������e�Zd�Zd��Zy)r����c������������������H����|�j�������������������5��|�j������������������j������������������|��������|�xj������������������dz ��c_��������|�j�������������������j ���������������������������|�j������������������|�j ������������������k(��r|�j������������������|�j������������������=�d�|�_��������d�d�d���������y�#�1�sw�Y���y�xY�wrn��) r`��rc��r����rd��rp��re��r����r����r|���rO��s��� r���r��zIMapUnorderedIterator._set���sj������ �Z�Z��K�K���s�#��K�K�1��K��J�J�����{�{�d�l�l�*��K�K�� � �*�!�� � ��Z�Z�s����BB�B!N)r%���r&���r'���r��r(���r���r���r����r�������s������"r���r����c��������������������Z�����e�Zd�ZdZed����������Zd d�Zd��Zd��Zed����������Z ed����������Z d ��Zy)r���Fc�����������������������ddl�m}��||i�|��S�)Nr���rt���)�dummyru���)rv���r���rc���ru���s��� r���ru���zThreadPool.Process���s������"���%��%�%r���Nc������������������4�����t���������j������������������|�|||��������y�r���)r���r!���)r ���r����rZ���r[���s��� r���r!���zThreadPool.__init__���s������� � �d�I�{�H�=r���c������������������������t��������j��������������������������|�_��������t��������j��������������������������|�_��������|�j������������������j������������������|�_��������|�j������������������j������������������|�_��������y�r���)r����r����r����r����rM���r����rN���r����r#���s��� r���r���zThreadPool._setup_queues���sD�������)�)�+�� ��*�*�,����-�-�+�+����.�.�,�,��r���c������������������0�����|�j�������������������j������������������gS�r���)r����rQ���r#���s��� r���r����zThreadPool._get_sentinels���s�������%�%�-�-�.�.r���c�����������������������g�S�r���r(���)r����s��� r���r����z ThreadPool._get_worker_sentinels���s������� r���c����������������������� � �|�j������������������d����������#�t��������j������������������$�r�Y�nw�xY�wt��������|�������D�]��}|�j ������������������d�����������y�)NF)�block)rN���r�����Emptyr����rM���)rX���r*��r��ra���s��� r���r+��zThreadPool._help_stuff_finish���sM������ �����%��(�����{�{�� �� ���t��A��K�K����s������,�,c������������������.�����t��������j������������������|��������y�r���)r(��r)��)r ���r����r��r��s��� r���r��zThreadPool._wait_for_updates���s������� � �7�r���)NNr(���)r%���r&���r'���r����r7��ru���r!���r���r����r����r+��r��r(���r���r���r���r������sU�������O��&���&�>�-�/�������������r���)Nr(���NF))�__all__ra��r���r����r����r����r(��r-���rP��r8��r,���r���r���r���� connectionr ���r ���r���r���r ����countr@��r���r���rU���r���r*���r3���r8���rg���rV����dictrk����objectr���r�����AsyncResultr���r����r����r���r(���r���r����<module>r������s������<� ������� ����������������'����������� ���i�o�o����5��i���0��0��<���<�"�GK��+<�Z �$���$�.v�6��v�x)8�&��)8�V���%"���%"�V?"�6��?"�J "�L�� "�$���$r���