� ��^i| � ��dZddgZddlmZddlmZddlmZddlmZ ddl m Z m Z m Z mZmZddlmZeejej fZed ��Zed ��Z dd lZd Zn #e$rd ZYnwxYwdZedede efd���Z dde egefde edede efd�Z dde egefde edede efd�Z dde egefde edede efd�ZerexZZd SeZeZd S)abConvenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't guarantee the order of processing of the elements of the iterable. - The underlying process/thread pools chop the iterable into a number of chunks, so that for very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. �map_multiprocess�map_multithread�)�contextmanager)�Pool��pool)�Callable�Iterable�Iterator�TypeVar�Union)�DEFAULT_POOLSIZE�S�TNFTi��r�returnc#��K� |V�|j��|j��|j��dS#|j��|j��|j��wxYw)z>Return a context manager making sure the pool closes properly.N)�close�join� terminaters ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/parallel.py�closingr.sy������ � � � �� � � � ��� � � � ���������� �� � � � ��� � � � ����������s �7�/A&��func�iterable� chunksizec�"�t||��S)z�Make an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable. )�map)rrrs r� _map_fallbackr;s�� �t�X� � ��c��tt����5}|j|||��cddd��S#1swxYwYdS)z�Chop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r� ProcessPool�imap_unordered�rrrrs r�_map_multiprocessr$Gs��� ���� � �>�4�"�t�"�4��9�=�=�>�>�>�>�>�>�>�>�>�>�>�>����>�>�>�>�>�>s �;�?�?c��ttt����5}|j|||��cddd��S#1swxYwYdS)z�Chop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. N)r� ThreadPoolrr"r#s r�_map_multithreadr'Us��� ��,�-�-� .� .�>�$�"�t�"�4��9�=�=�>�>�>�>�>�>�>�>�>�>�>�>����>�>�>�>�>�>s�A�A�A)r)�__doc__�__all__� contextlibr�multiprocessingrr!r�multiprocessing.dummyr&�typingr r r r r �pip._vendor.requests.adaptersrrr�multiprocessing.synchronize� LACK_SEM_OPEN� ImportError�TIMEOUTr�intrr$r'rr�rr�r5sg����$ �0� 1��%�%�%�%�%�%�/�/�/�/�/�/� � � � � � �4�4�4�4�4�4�?�?�?�?�?�?�?�?�?�?�?�?�?�?�:�:�:�:�:�:� �T�Y��� '�(�� �G�C�L�L�� �G�C�L�L���&�&�&�&��M�M�������M�M�M����� ��� �$� �8�D�>� � � ��� �EF� � � �A�3��6� � �&.�q�k� �>A� � �a�[� � � � �EF� >� >� �A�3��6� � >�&.�q�k� >�>A� >� �a�[� >� >� >� >�EF� >� >� �A�3��6� � >�&.�q�k� >�>A� >� �a�[� >� >� >� >��'�)6�6�����(��&�O�O�Os�A%�%A/�.A/